lightweight function for measuring time ( better than clock_getime )


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat lightweight function for measuring time ( better than clock_getime )
# 1  
Old 07-17-2011
lightweight function for measuring time ( better than clock_getime )

HI
I have a Red Hat Enterprise with Real Time kernel.

Are you aware if there are C functions for this kernel or some code/library for this OS for measuring time more lightweight than clock_gettime and gettimeofday? THe hardware I have is NUMA.

Reading forums I found gethrtime but it is available on Solaris only; this last spends few cycles compared to clock_gettime and gettimeofday eating the CPU.

Do you know if for Red Hat someomene did something similar?
My distro is the following

THanks a lot

Code:
     uname -a
     Linux lndbxdev01 2.6.24.7-108.el5rt #1 SMP PREEMPT RT 
     Mon Mar 23 10:58:10 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

     cat/etc/redhat-release
     Red Hat Enterprise Linux Server release 5.3 (Tikanga)

# 2  
Old 07-19-2011
Hi
after few research I didn't find a better function than clock_getime or a specific function for RedHat distro BUT I can tell you that in the 2.6 kernel there are new ID available for clock_getime.
If you use version 2.6.28 you can use a new clock type, CLOCK_MONOTONIC_RAW
If you use version 2.6.32 you can use a new clock type, CLOCK_REALTIME_COARSE and CLOCK_MONOTIC_COARSE.

Someone did some tests with it and they seem 5 times faster than the code used by CLOCK_MONOTONIC and CLOCK_REALTIME.

Best Regards
MNSTN
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Ubuntu

Measuring the correctness of ndelay() function.

I wrote this kernel module to test the correctness of ndelay() function. Kernel mdoule: #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/time.h> #include <linux/delay.h> static int __init initialize(void) { ktime_t start, end; s64... (1 Reply)
Discussion started by: BHASKAR JUPUDI
1 Replies

2. UNIX for Dummies Questions & Answers

time function

hello everybody! i want to post a question. So, I use the command 'time a.out' to time the duration of the program a.out. The return value of this function was: real 0m4.116s user 0m4.112s sys 0m0.016s What i want is! I try to find a way to get (NOT manually) the value of real time.... (2 Replies)
Discussion started by: nicos
2 Replies

3. Shell Programming and Scripting

Nawk Time Function

Hi All, I am using solaris and nawk. Is there any time function in nawk which is simliar to the shell `date` function ? Can any experts show any examples? (4 Replies)
Discussion started by: Raynon
4 Replies

4. Programming

function time

Hello I have problem with function 'time' to test my program for file copying . How to run the function in my source code ? I try something like that: system("time"); < -- but this don't working (2 Replies)
Discussion started by: scotty_123
2 Replies

5. Shell Programming and Scripting

time function

Hi, I would like to display the exact time taken to complete running a particular tool or function or program to user I don't know the exact time functions in unix, please help me thanks in advance Example: $test.ksh output should be The... (10 Replies)
Discussion started by: hsekol
10 Replies

6. Programming

C time in milliseconds function.

I need a c function which return the time in: hour min sec and mil sec I am writing on unix os. (3 Replies)
Discussion started by: kamil
3 Replies

7. Programming

Measuring System Call Time

Can anyone please help me in measuring the system call timings! How do I do it if I have to measure the timing of an operation, say getpid system call. What different functions can I use for that and what would be the difference using each of them? Thanx! (3 Replies)
Discussion started by: chacha
3 Replies
Login or Register to Ask a Question

Featured Tech Videos