正在显示
1 个修改的文件
包含
19 行增加
和
2 行删除
@@ -1374,19 +1374,30 @@ void srs_api_dump_summaries(std::stringstream& ss) | @@ -1374,19 +1374,30 @@ void srs_api_dump_summaries(std::stringstream& ss) | ||
1374 | int64_t n_sample_time = 0; | 1374 | int64_t n_sample_time = 0; |
1375 | int64_t nr_bytes = 0; | 1375 | int64_t nr_bytes = 0; |
1376 | int64_t ns_bytes = 0; | 1376 | int64_t ns_bytes = 0; |
1377 | + int64_t nri_bytes = 0; | ||
1378 | + int64_t nsi_bytes = 0; | ||
1377 | int nb_n = srs_get_network_devices_count(); | 1379 | int nb_n = srs_get_network_devices_count(); |
1378 | for (int i = 0; i < nb_n; i++) { | 1380 | for (int i = 0; i < nb_n; i++) { |
1379 | SrsNetworkDevices& o = n[i]; | 1381 | SrsNetworkDevices& o = n[i]; |
1380 | 1382 | ||
1381 | // ignore the lo interface. | 1383 | // ignore the lo interface. |
1382 | std::string inter = o.name; | 1384 | std::string inter = o.name; |
1383 | - if (!o.ok || inter == "lo" || !srs_net_device_is_internet(inter)) { | 1385 | + if (!o.ok) { |
1386 | + continue; | ||
1387 | + } | ||
1388 | + | ||
1389 | + // update the sample time. | ||
1390 | + n_sample_time = o.sample_time; | ||
1391 | + | ||
1392 | + // stat the intranet bytes. | ||
1393 | + if (inter == "lo" || !srs_net_device_is_internet(inter)) { | ||
1394 | + nri_bytes += o.rbytes; | ||
1395 | + nsi_bytes += o.sbytes; | ||
1384 | continue; | 1396 | continue; |
1385 | } | 1397 | } |
1386 | 1398 | ||
1387 | nr_bytes += o.rbytes; | 1399 | nr_bytes += o.rbytes; |
1388 | ns_bytes += o.sbytes; | 1400 | ns_bytes += o.sbytes; |
1389 | - n_sample_time = o.sample_time; | ||
1390 | } | 1401 | } |
1391 | 1402 | ||
1392 | // all data is ok? | 1403 | // all data is ok? |
@@ -1425,9 +1436,15 @@ void srs_api_dump_summaries(std::stringstream& ss) | @@ -1425,9 +1436,15 @@ void srs_api_dump_summaries(std::stringstream& ss) | ||
1425 | << SRS_JFIELD_ORG("load_1m", p->load_one_minutes) << SRS_JFIELD_CONT | 1436 | << SRS_JFIELD_ORG("load_1m", p->load_one_minutes) << SRS_JFIELD_CONT |
1426 | << SRS_JFIELD_ORG("load_5m", p->load_five_minutes) << SRS_JFIELD_CONT | 1437 | << SRS_JFIELD_ORG("load_5m", p->load_five_minutes) << SRS_JFIELD_CONT |
1427 | << SRS_JFIELD_ORG("load_15m", p->load_fifteen_minutes) << SRS_JFIELD_CONT | 1438 | << SRS_JFIELD_ORG("load_15m", p->load_fifteen_minutes) << SRS_JFIELD_CONT |
1439 | + // system network bytes stat. | ||
1428 | << SRS_JFIELD_ORG("net_sample_time", n_sample_time) << SRS_JFIELD_CONT | 1440 | << SRS_JFIELD_ORG("net_sample_time", n_sample_time) << SRS_JFIELD_CONT |
1441 | + // internet public address network device bytes. | ||
1429 | << SRS_JFIELD_ORG("net_recv_bytes", nr_bytes) << SRS_JFIELD_CONT | 1442 | << SRS_JFIELD_ORG("net_recv_bytes", nr_bytes) << SRS_JFIELD_CONT |
1430 | << SRS_JFIELD_ORG("net_send_bytes", ns_bytes) << SRS_JFIELD_CONT | 1443 | << SRS_JFIELD_ORG("net_send_bytes", ns_bytes) << SRS_JFIELD_CONT |
1444 | + // intranet private address network device bytes. | ||
1445 | + << SRS_JFIELD_ORG("net_recvi_bytes", nri_bytes) << SRS_JFIELD_CONT | ||
1446 | + << SRS_JFIELD_ORG("net_sendi_bytes", nsi_bytes) << SRS_JFIELD_CONT | ||
1447 | + // srs network bytes stat. | ||
1431 | << SRS_JFIELD_ORG("srs_sample_time", nrs->sample_time) << SRS_JFIELD_CONT | 1448 | << SRS_JFIELD_ORG("srs_sample_time", nrs->sample_time) << SRS_JFIELD_CONT |
1432 | << SRS_JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << SRS_JFIELD_CONT | 1449 | << SRS_JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << SRS_JFIELD_CONT |
1433 | << SRS_JFIELD_ORG("srs_send_bytes", nrs->sbytes) << SRS_JFIELD_CONT | 1450 | << SRS_JFIELD_ORG("srs_send_bytes", nrs->sbytes) << SRS_JFIELD_CONT |
-
请 注册 或 登录 后发表评论