eLinux.org - Embedded Linux Wiki

Kft Misc Notes

From eLinux.org

Jump to: navigation, search

This page has random information related to KFT (mainly for use in developing KFT)

Cost of certain operations (including cmpxchg)

I just recently added locking of the trace log in the SMP case, using cmpxchg.

Here are some notes comparing an empty syscall, a straight write, and a cmpxchg operation. These were posted by Mathieu Desnoyers on the ltt-dev list Sep 28, 2005.


compudj@dijkstra:~/test$ ./syscall_time 
CPU KHz is 3000842

Time for a system call (returns after a simple test) :
TSC diff : 14925 cycles
time diff : 4973.6 ns

Time for a 1 unsigned long long and 4 int write :
TSC diff : 113 cycles
time diff : 37.6561 ns

Time for a cmpxchg :
TSC diff : 540 cycles
time diff : 179.949 ns
Personal tools