rdtsc Questions

1

I am conducting a test to measure the message synchronization latency between different cores of a CPU. Specifically, I am measuring how many clock cycles it takes for CPU2 to detect changes in the...
Chema asked 24/11, 2023 at 14:0

2

Solved

Supposed we have some repetitions of the same asm that contains RDTSC such as volatile size_t tick1; asm ( "rdtsc\n" // Returns the time in EDX:EAX. "shl $32, %%rdx\n" // Shi...
Citrin asked 15/8, 2023 at 6:29

4

Solved

I have seen the related question including here and here, but it seems that the only instruction ever mentioned for serializing rdtsc is cpuid. Unfortunately, cpuid takes roughly 1000 cycles on my ...
Silverside asked 24/4, 2014 at 22:2

1

Solved

I'm confused whether rdtscp monotonically increments in a multi-core environment. According to the document: __rdtscp, rdtscp seems a processor-based instruction and can prevent reordering of instr...
Tecu asked 31/1, 2021 at 4:5

7

Solved

I am using the following code to profile my operations to optimize on cpu cycles taken in my functions. static __inline__ unsigned long GetCC(void) { unsigned a, d; asm volatile("rdtsc" : "=a" ...
Anemometry asked 30/9, 2010 at 13:19

5

Solved

I saw this post on SO which contains C code to get the latest CPU Cycle count: CPU Cycle count based profiling in C/C++ Linux x86_64 Is there a way I can use this code in C++ (windows and linux s...
Kwei asked 7/12, 2012 at 23:18

1

Solved

I used to benchmark Linux System Calls with rdtsc to get the counter difference before and after the system call. I interpreted the result as wall clock timer since TSC increments at constant rate ...
Freefloating asked 20/6, 2020 at 21:43

1

Solved

As far as I know, the main difference in runtime ordering in a processor with respect to rdtsc and rdtscp instruction is that whether the execution waits until all previous instructions are execute...
Slipsheet asked 15/1, 2020 at 21:10

1

I'm new to C++ and benchmarking I don't understand what the this part of the code does? So I found something about the edx, eax registers, but I don't fully understand how that plays into th...
Fawkes asked 8/7, 2019 at 17:41

1

Solved

Can different processes run RDTSC at the same time? Or is this a resource that only one core can operate on at the same time? TSC is in every core (at least you can adjust it separately for every c...
Snowblind asked 4/6, 2019 at 8:2

1

I am using RDTSCP to replace LFENCE;RDTSC sequences and also get the processor ID back so that I know when I'm comparing TSC values after the thread was rescheduled to another CPU. To ensure I don...
Lickspittle asked 7/6, 2016 at 15:2

1

I am trying to replace clock_gettime(CLOCK_REALTIME, &ts) with rdtsc to benchmark code execution time in terms of cpu cycles rather than server time. The execution time of the bench-marking cod...
Restoration asked 14/2, 2019 at 12:43

1

Solved

I am using RDTSC and RDTSCP in NASM to measure machine cycles for various assembly language instructions to help in optimization. I read "How to Benchmark Code Execution Times on Intel IA-32 and ...
Clambake asked 10/2, 2019 at 21:43

3

Solved

Sometimes I encounter code that reads TSC with rdtsc instruction, but calls cpuid right before. Why is calling cpuid necessary? I realize it may have something to do with different cores having TS...
Osterman asked 27/5, 2010 at 2:29

2

Solved

I am trying to profile a code for execution time on an x86-64 processor. I am referring to this Intel white paper and also gone through other SO threads discussing the topic of using RDTSCP vs CPUI...
Neal asked 24/12, 2018 at 0:46

4

I have an assembly program that has the following code. This code compiles fine for a intel processor. But, when I use a PPC (cross)compiler, I get an error that the opcode is not recognized. I am ...
Phidias asked 4/5, 2011 at 12:9

0

For many years x86 CPUs supported the rdtsc instruction, which reads the "time stamp counter" of the current CPU. The exact definition of this counter has changed over time, but on recent CPUs it i...
Moncrief asked 4/9, 2018 at 3:53

1

Solved

As a follow-up to this topic, in order to calculate the memory miss latency, I have wrote the following code using _mm_clflush, __rdtsc and _mm_lfence (which is based on the code from this question...
Flamenco asked 22/8, 2018 at 9:32

0

Given an x86 with a constant TSC, which is useful for measuring real time, how can one convert between the "units" of TSC reference cycles and normal human real-time units like nanoseconds using th...
Cheryl asked 19/8, 2018 at 15:34

3

I am running this test on a cpu with constant_tsc and nonstop_tsc $ grep -m 1 ^flags /proc/cpuinfo | sed 's/ /\n/g' | egrep "constant_tsc|nonstop_tsc" constant_tsc nonstop_tsc Step 1: Calculate ...
Pneumograph asked 25/8, 2016 at 17:7

9

I am writing a C code for measuring the number of clock cycles needed to acquire a semaphore. I am using rdtsc, and before doing the measurement on the semaphore, I call rdtsc two consecutive times...
Metaphrast asked 12/11, 2013 at 22:49

4

Solved

With Visual Studio I can read the clock cycle count from the processor as shown below. How do I do the same thing with GCC? #ifdef _MSC_VER // Compiler: Microsoft Visual Studio #ifdef _M_I...
Radiochemical asked 27/3, 2012 at 10:32

1

Solved

On recent CPUs (at least the last decade or so) Intel has offered three fixed-function hardware performance counters, in addition to various configurable performance counters. The three fixed count...
Cattycornered asked 2/8, 2017 at 22:41

2

I don't know what exactly does this code: int rdtsc(){ __asm__ __volatile__("rdtsc"); Please, someone can explain me? why "rdtsc"?
Brownedoff asked 1/5, 2014 at 5:47

2

Solved

Suppose all the cores in my CPU have same frequency, technically I can synchronize system time and time stamp counter pairs for each core every millisecond or so. Then based on the current core I'm...
Amiens asked 12/2, 2017 at 16:14

© 2022 - 2024 — McMap. All rights reserved.