summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36c657e)
raw | patch | inline | side by side (parent: 36c657e)
author | Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com> | |
Tue, 24 Jan 2017 14:23:10 +0000 (14:23 +0000) | ||
committer | Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com> | |
Tue, 24 Jan 2017 15:20:10 +0000 (15:20 +0000) |
This patch fixes parsing of metrics' types. Some statistics, such as
rx_q0errors, rx_q0bytes or rx_q0packet, don't contain suffix _errors, _bytes or
_packets. This has caused them to use generic type 'derive', rather than
more specific one, for instance 'if_rx_errors'. Additionally, some
statistics contain string 'error', rather than 'errors'.
Change-Id: Ifd4ed6c0d2c21723900f36fb1a376d4673e59850
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com>
rx_q0errors, rx_q0bytes or rx_q0packet, don't contain suffix _errors, _bytes or
_packets. This has caused them to use generic type 'derive', rather than
more specific one, for instance 'if_rx_errors'. Additionally, some
statistics contain string 'error', rather than 'errors'.
Change-Id: Ifd4ed6c0d2c21723900f36fb1a376d4673e59850
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com>
src/dpdkstat.c | patch | blob | history |
diff --git a/src/dpdkstat.c b/src/dpdkstat.c
index e33507251a4302de80199aafc9a5d261cdbf5a19..fd11097628afcce554c3f2ece05796b093c04bb3 100644 (file)
--- a/src/dpdkstat.c
+++ b/src/dpdkstat.c
type_end = strrchr(cnt_name, '_');
if ((type_end != NULL) && (strncmp(cnt_name, "rx_", strlen("rx_")) == 0)) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ if (strstr(type_end, "bytes") != NULL) {
+ sstrncpy(cnt_type, "if_rx_octets", cnt_type_len);
+ } else if (strstr(type_end, "error") != NULL) {
sstrncpy(cnt_type, "if_rx_errors", cnt_type_len);
- } else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
+ } else if (strstr(type_end, "dropped") != NULL) {
sstrncpy(cnt_type, "if_rx_dropped", cnt_type_len);
- } else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(cnt_type, "if_rx_octets", cnt_type_len);
- } else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
+ } else if (strstr(type_end, "packets") != NULL) {
sstrncpy(cnt_type, "if_rx_packets", cnt_type_len);
- } else if (strncmp(type_end, "_placement", strlen("_placement")) == 0) {
+ } else if (strstr(type_end, "_placement") != NULL) {
sstrncpy(cnt_type, "if_rx_errors", cnt_type_len);
- } else if (strncmp(type_end, "_buff", strlen("_buff")) == 0) {
+ } else if (strstr(type_end, "_buff") != NULL) {
sstrncpy(cnt_type, "if_rx_errors", cnt_type_len);
} else {
/* Does not fit obvious type: use a more generic one */
} else if ((type_end != NULL) &&
(strncmp(cnt_name, "tx_", strlen("tx_"))) == 0) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ if (strstr(type_end, "bytes") != NULL) {
+ sstrncpy(cnt_type, "if_tx_octets", cnt_type_len);
+ } else if (strstr(type_end, "error") != NULL) {
sstrncpy(cnt_type, "if_tx_errors", cnt_type_len);
- } else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
+ } else if (strstr(type_end, "dropped") != NULL) {
sstrncpy(cnt_type, "if_tx_dropped", cnt_type_len);
- } else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(cnt_type, "if_tx_octets", cnt_type_len);
- } else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
+ } else if (strstr(type_end, "packets") != NULL) {
sstrncpy(cnt_type, "if_tx_packets", cnt_type_len);
} else {
/* Does not fit obvious type: use a more generic one */
} else if ((type_end != NULL) &&
(strncmp(cnt_name, "flow_", strlen("flow_"))) == 0) {
- if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
+ if (strstr(type_end, "_filters") != NULL) {
sstrncpy(cnt_type, "operations", cnt_type_len);
- } else if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ } else if (strstr(type_end, "error") != NULL)
sstrncpy(cnt_type, "errors", cnt_type_len);
- } else if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
- sstrncpy(cnt_type, "filter_result", cnt_type_len);
- }
+
} else if ((type_end != NULL) &&
(strncmp(cnt_name, "mac_", strlen("mac_"))) == 0) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ if (strstr(type_end, "error") != NULL) {
sstrncpy(cnt_type, "errors", cnt_type_len);
}
} else {