Hi,

DPDK has a function called /rte_get_tsc_cycles() /to get the number of CPU cycles since boot. If I'm not wrong, it can be used to calculate time elapsed in milliseconds (or any other precision needed).

The following code snippet shows how to calculated time elapsed:

```

uint64_t start = rte_get_tsc_cycles();

<perform operations>

double cpu_time = (double)(rte_get_tsc_cycles() - start) / rte_get_tsc_hz(); // gives the time elapsed since start

```

I believe it can be suitably modified to generate timestamps. It'll be important to consider what time is taken as 0 while timestamping.


Hope that helps!


Regards,

Archit.
//

On 11/12/2019 2:10 PM, Gokul Bargaje wrote:
Hi Team,

Like in Java, there is a method called getTimeInMillis() which returns the
current timestamp in milliseconds. I want to know if there's a way to find
out timestamp in milliseconds (or in Microseconds) in the C language or in
the DPDK?

I did some googling and I got the solution which returns the time in
seconds but I need time in milliseconds.

Thanks,
Gokul

--
Archit Pandey
Senior Year Undergraduate Student
Department of Computer Science and Engineering
National Institute of Technology Karnataka
Surathkal, India

Reply via email to