MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pcapng_timestamp

Function pcapng_timestamp

dpdk/lib/pcapng/rte_pcapng.c:101–115  ·  view source on GitHub ↗

Convert from TSC (CPU cycles) to nanoseconds */

Source from the content-addressed store, hash-verified

99
100/* Convert from TSC (CPU cycles) to nanoseconds */
101static uint64_t
102pcapng_timestamp(const rte_pcapng_t *self, uint64_t cycles)
103{
104 uint64_t delta, rem, secs, ns;
105 const uint64_t hz = rte_get_tsc_hz();
106
107 delta = cycles - self->tsc_base;
108
109 /* Avoid numeric wraparound by computing seconds first */
110 secs = delta / hz;
111 rem = delta % hz;
112 ns = (rem * NS_PER_S) / hz;
113
114 return secs * NS_PER_S + ns + self->offset_ns;
115}
116
117/* length of option including padding */
118static uint16_t pcapng_optlen(uint16_t len)

Callers 2

rte_pcapng_write_statsFunction · 0.85
rte_pcapng_write_packetsFunction · 0.85

Calls 1

rte_get_tsc_hzFunction · 0.85

Tested by

no test coverage detected