MCPcopy Create free account
hub / github.com/apache/mesos / statistics

Function statistics

src/linux/routing/link/link.cpp:354–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352
353
354Result<hashmap<string, uint64_t>> statistics(const string& _link)
355{
356 Result<Netlink<struct rtnl_link>> link = internal::get(_link);
357 if (link.isError()) {
358 return Error(link.error());
359 } else if (link.isNone()) {
360 return None();
361 }
362
363 rtnl_link_stat_id_t stats[] = {
364 // Statistics related to receiving.
365 RTNL_LINK_RX_PACKETS,
366 RTNL_LINK_RX_BYTES,
367 RTNL_LINK_RX_ERRORS,
368 RTNL_LINK_RX_DROPPED,
369 RTNL_LINK_RX_COMPRESSED,
370 RTNL_LINK_RX_FIFO_ERR,
371 RTNL_LINK_RX_LEN_ERR,
372 RTNL_LINK_RX_OVER_ERR,
373 RTNL_LINK_RX_CRC_ERR,
374 RTNL_LINK_RX_FRAME_ERR,
375 RTNL_LINK_RX_MISSED_ERR,
376 RTNL_LINK_MULTICAST,
377
378 // Statistics related to sending.
379 RTNL_LINK_TX_PACKETS,
380 RTNL_LINK_TX_BYTES,
381 RTNL_LINK_TX_ERRORS,
382 RTNL_LINK_TX_DROPPED,
383 RTNL_LINK_TX_COMPRESSED,
384 RTNL_LINK_TX_FIFO_ERR,
385 RTNL_LINK_TX_ABORT_ERR,
386 RTNL_LINK_TX_CARRIER_ERR,
387 RTNL_LINK_TX_HBEAT_ERR,
388 RTNL_LINK_TX_WIN_ERR,
389 RTNL_LINK_COLLISIONS,
390 };
391
392 hashmap<string, uint64_t> results;
393
394 char buf[32];
395 size_t size = sizeof(stats) / sizeof(stats[0]);
396
397 for (size_t i = 0; i < size; i++) {
398 rtnl_link_stat2str(stats[i], buf, 32);
399 results[buf] = rtnl_link_get_stat(link->get(), stats[i]);
400 }
401
402 return results;
403}
404
405} // namespace link {
406} // namespace routing {

Callers 4

foreachFunction · 0.50
TEST_FFunction · 0.50
executeMethod · 0.50
usageMethod · 0.50

Calls 7

NoneClass · 0.85
getFunction · 0.70
errorMethod · 0.65
ErrorFunction · 0.50
isErrorMethod · 0.45
isNoneMethod · 0.45
getMethod · 0.45

Tested by 2

foreachFunction · 0.40
TEST_FFunction · 0.40