git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc: fix wording and formatting of mlx5 guide
[dpdk.git]
/
lib
/
librte_latencystats
/
rte_latencystats.c
diff --git
a/lib/librte_latencystats/rte_latencystats.c
b/lib/librte_latencystats/rte_latencystats.c
index
1fdec68
..
06c6283
100644
(file)
--- a/
lib/librte_latencystats/rte_latencystats.c
+++ b/
lib/librte_latencystats/rte_latencystats.c
@@
-7,6
+7,7
@@
#include <stdbool.h>
#include <math.h>
#include <stdbool.h>
#include <math.h>
+#include <rte_string_fns.h>
#include <rte_mbuf.h>
#include <rte_log.h>
#include <rte_cycles.h>
#include <rte_mbuf.h>
#include <rte_log.h>
#include <rte_cycles.h>
@@
-125,8
+126,11
@@
add_time_stamps(uint16_t pid __rte_unused,
for (i = 0; i < nb_pkts; i++) {
diff_tsc = now - prev_tsc;
timer_tsc += diff_tsc;
for (i = 0; i < nb_pkts; i++) {
diff_tsc = now - prev_tsc;
timer_tsc += diff_tsc;
- if (timer_tsc >= samp_intvl) {
+
+ if ((pkts[i]->ol_flags & PKT_RX_TIMESTAMP) == 0
+ && (timer_tsc >= samp_intvl)) {
pkts[i]->timestamp = now;
pkts[i]->timestamp = now;
+ pkts[i]->ol_flags |= PKT_RX_TIMESTAMP;
timer_tsc = 0;
}
prev_tsc = now;
timer_tsc = 0;
}
prev_tsc = now;
@@
-156,7
+160,7
@@
calc_latency(uint16_t pid __rte_unused,
now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++) {
now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++) {
- if (pkts[i]->
timestamp
)
+ if (pkts[i]->
ol_flags & PKT_RX_TIMESTAMP
)
latency[cnt++] = now - pkts[i]->timestamp;
}
latency[cnt++] = now - pkts[i]->timestamp;
}
@@
-306,8
+310,8
@@
rte_latencystats_get_names(struct rte_metric_name *names, uint16_t size)
return NUM_LATENCY_STATS;
for (i = 0; i < NUM_LATENCY_STATS; i++)
return NUM_LATENCY_STATS;
for (i = 0; i < NUM_LATENCY_STATS; i++)
- s
nprintf(names[i].name, sizeof(names[i].name)
,
-
"%s", lat_stats_strings[i].name
);
+ s
trlcpy(names[i].name, lat_stats_strings[i].name
,
+
sizeof(names[i].name)
);
return NUM_LATENCY_STATS;
}
return NUM_LATENCY_STATS;
}