summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 877672d)
raw | patch | inline | side by side (parent: 877672d)
author | Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com> | |
Wed, 8 Feb 2017 14:28:09 +0000 (14:28 +0000) | ||
committer | Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com> | |
Wed, 8 Feb 2017 14:48:37 +0000 (14:48 +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: I51dfa9c4d98346a654adbc4041b64ebd3897278c
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: I51dfa9c4d98346a654adbc4041b64ebd3897278c
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 d1383458d6cd683f8a674ac53591aaf786e6a8ef..6d0aabf7be464f4da088a932197d88f9dbaf14fa 100644 (file)
--- a/src/dpdkstat.c
+++ b/src/dpdkstat.c
if ((type_end != NULL) &&
(strncmp(counter_name, "rx_", strlen("rx_")) == 0)) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ if (strstr(type_end, "bytes") != NULL) {
+ sstrncpy(vl.type, "if_rx_octets", sizeof(vl.type));
+ } else if (strstr(type_end, "error") != NULL) {
sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
+ } else if (strstr(type_end, "dropped") != NULL) {
sstrncpy(vl.type, "if_rx_dropped", sizeof(vl.type));
- } else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(vl.type, "if_rx_octets", sizeof(vl.type));
- } else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
+ } else if (strstr(type_end, "packets") != NULL) {
sstrncpy(vl.type, "if_rx_packets", sizeof(vl.type));
- } else if (strncmp(type_end, "_placement", strlen("_placement")) == 0) {
+ } else if (strstr(type_end, "_placement") != NULL) {
sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_buff", strlen("_buff")) == 0) {
+ } else if (strstr(type_end, "_buff") != NULL) {
sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
} else {
/* Does not fit obvious type: use a more generic one */
} else if ((type_end != NULL) &&
(strncmp(counter_name, "tx_", strlen("tx_"))) == 0) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ if (strstr(type_end, "bytes") != NULL) {
+ sstrncpy(vl.type, "if_tx_octets", sizeof(vl.type));
+ } else if (strstr(type_end, "error") != NULL) {
sstrncpy(vl.type, "if_tx_errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
+ } else if (strstr(type_end, "dropped") != NULL) {
sstrncpy(vl.type, "if_tx_dropped", sizeof(vl.type));
- } else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(vl.type, "if_tx_octets", sizeof(vl.type));
- } else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
+ } else if (strstr(type_end, "packets") != NULL) {
sstrncpy(vl.type, "if_tx_packets", sizeof(vl.type));
} else {
/* Does not fit obvious type: use a more generic one */
} else if ((type_end != NULL) &&
(strncmp(counter_name, "flow_", strlen("flow_"))) == 0) {
- if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
+ if (strstr(type_end, "_filters") != NULL) {
sstrncpy(vl.type, "operations", sizeof(vl.type));
- } else if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ } else if (strstr(type_end, "error") != NULL)
sstrncpy(vl.type, "errors", sizeof(vl.type));
- } else if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
- sstrncpy(vl.type, "filter_result", sizeof(vl.type));
- }
+
} else if ((type_end != NULL) &&
(strncmp(counter_name, "mac_", strlen("mac_"))) == 0) {
- if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
+ if (strstr(type_end, "error") != NULL) {
sstrncpy(vl.type, "errors", sizeof(vl.type));
}
} else {