Programming :: Difference In Time Recorded By Clock_gettime() And TSC?

Jan 24, 2011

I want to measure the time it takes to execute a C function. The question is which is the best method to record time. After a lot of searching online, I found two ways [URL]:

a. using clock_gettime(CLOCK_MONOTONIC, &t)
b. using TSC

I call the C function 50 times (recording the time it takes for each call). The average is found only for the last 35 calls.

Using (a), I get:

48345 us
28350 us
28379 us
27716 us

[code]....

Average time for the last 35 loops: 121450.47 microseconds

Using (b), I get:

48130 cycles
28726 cycles
28820 cycles
27421 cycles

[code]....

Average for the last 35 loops: 27236.66 cycles What could be causing the strange value of 3322259 us in method (a)? I could just use method (b) but I would like to know what is going on here... Btw, I am using a desktop - with Linux debian 2.6.26 #1 SMP.

View 7 Replies


ADVERTISEMENT

General :: How To Track Elapsed Real-time - Undefined Reference To `clock_gettime'

Jan 28, 2010

What is the best way to track elapsed real-time, for the most kinds of Linux systems?

clock_gettime() looks great, but I get this build error:

undefined reference to `clock_gettime'

..even though I have #include "time.h" Here is my uber-goal:

// Returns fractional seconds that have elapsed since Start_Ticks was set.
float elapsed_seconds( unsigned Start_Ticks )
{

[code]....

View 1 Replies View Related

General :: Computer Time Difference At Windows / Make The Time The Same?

Apr 13, 2011

My computer has different time when booting to linux or Windows.How to make the time the same?My computer time is 10:57pm Apr 14 when booting to linux.My computer time is 2:57am Apr 14 when booting to Windows Vista Home Premimum SP2.Both OS are set to the same time zone (GMT-5. Eastern Time US & Canada).

View 5 Replies View Related

Programming :: Typical Error "undefined Reference To Clock_gettime"

Oct 14, 2010

I am slowly getting accustomed with linux issues and its different programming compilation stuffs. and i must say am truly liking it. Now i am facing this typical error , "undefined reference to `clock_gettime'" while i am compiling a code, which is not mine as it required to install a simulator. Now i have read about this type for the last 2 days and i have included "-lrt" in the make file and included <time.h> in the header files which was missing but still i am getting that error.

Now matter how many times i run the make file with the required changes its still giving me this error, which i have comprehended as mainly linking problem rather than a compilation issue.

View 4 Replies View Related

General :: Difference Between System Uptime And Last Boot Time?

May 11, 2011

My Linux system was last rebooted few hours ago. But it seems little confusing for me to figure out the exact reason behind it. I guess following command should justify what i meant to say.

Code:
# date
Wed May 11 13:22:49 IST 2011
# last | grep "May 10"
reboot system boot 2.6.18-194.el5 Tue May 10 17:35 (19:46)
root pts/1 XXXX Tue May 10 17:24 - 18:18 (00:53)

[Code]...

My question is Why the uptime is saying that the system is up since last 47 min.It should be more than 1 day if i m not wrong.

View 2 Replies View Related

CentOS 5 :: High CPU Usage On Clock_gettime() C - C++

Apr 5, 2011

I am calling clock_gettime() function to get time with nano seconds accuracy. My program works fine on Ubuntu but have high CPU usage problem on CentOS 5. it takes 40% CPU on Ubuntu and 90% CPU on CentOS. Kindly give me solution so that I can reduce high CPU usage problem on CentOS. You can build this code like: "gcc -lrt gettime.c -o gettime.e"

[Code]....

View 1 Replies View Related

General :: Error: Couldn't Find Clock_gettime?

Jul 3, 2010

When i install libdrm, i get the following error:checking for clock_gettime... no.checking for clock_gettime in -lrt... no.configure: error: Couldn't find clock_gettime

It seems that it cannt find clock_gettime function, but i find it as follow:
$ grep clock_gettime /usr/include/time.h
extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;

View 6 Replies View Related

Programming :: 3D Programming - Difference Between JOGL And C++ OpenGL Programming?

Aug 27, 2010

I am interested in learning 3D programming. The thing is, I would hate to put too much effort to learn something that doesn't have future and is dying. My favorite language at the time is Java. My goal is professional programming.

So I have several questions:
1. Should I learn JOGL or start learning C++ and do C++ openGL programming?
2. Is there a big difference between JOGL and C++ openGL programming?
3. Is it worth to learn openGL? Does it have a future?
4. Is it a big difference between openGL and directX coding?
5. If choosing Java, then JOGL or LWJGL?

Why and what is the main difference between them?

View 4 Replies View Related

Programming :: Function Handler Is Called One Time Only Instead 2 Times If The 2 Timers Expires At A Time

Mar 2, 2011

I am using Debian linux. I have 100 timers running. If a timer expired which will generate a signal and it was mapped to a same function handler. All the timers are mapped to one function handler. The problem is if the timer expires one at a time, the function handler called at a time. But if the 2 timers expires at a time, the function handler is called one time only instead 2 times. Is it possible to invoke the function handler as many times based on timer expirary happens simultaneoulsy?

View 14 Replies View Related

Programming :: Get The Current Time As Provided From NTP (not The Currently Set Time On The Server)?

Jun 9, 2010

Is there a way to get the current time as provided from NTP (not the currently set time on the server)?

View 4 Replies View Related

Programming :: Set Time Using Settimeofday But It Sets Local Time?

Jan 12, 2010

I am trying to set time using settimeofday in linux. But it sets local time. i.e works like SetLocalTime in windows. But I want to set system time(like SetSystemTime in windows). I could'nt find no other api in linux. What should i do? I had tried with mktime/gmtime apis

View 3 Replies View Related

Programming :: Difference Between Two Packages Of JDK

May 3, 2010

Ubuntu 10.04 lucid. sun-java6-jdk has been dropped from the Multiverse section of the Ubuntu archive. They recommend using openjdk-6 instead. Is there any difference between these 2 packages?

View 3 Replies View Related

Programming :: Difference Between /bin/bash And /bin/sh?

Dec 27, 2008

I know it's a very silly question but could someone please explain the difference between "/bin/bash" & "/bin/sh" I was under the impression that both are same but following output on my Ubuntu 8.10 is making me raise my eyebrows.

Quote:

parag@station3:~$ ls -l /bin/bash ; ls -l /bin/sh
-rwxr-xr-x 1 root root 725136 2008-05-13 00:18 /bin/bash
lrwxrwxrwx 1 root root 4 2008-12-03 21:42 /bin/sh -> dash
parag@station3:~$

View 11 Replies View Related

Programming :: Difference In SSH And Solaris?

Nov 1, 2010

I would like know know difference in ssh comman in solaris and linux, are they both same?

View 2 Replies View Related

Programming :: Defining Functions - What Is The Difference?

Aug 12, 2010

But what is the difference between this...

Code:
my_fucnction () {
echo "Hello World"
}
Code:
function my_fucnction {

[Code]...

View 10 Replies View Related

Programming :: Difference Between Hexdump And Objdump?

Aug 15, 2010

I am not clear with difference between hexdump and objdump and coredump. I wrote a small program

Code:
main (){
int a=2;
int b=4;
int k=b/a;
int m=9;

[Code].....

Some of the above instructions such as 89 d0 should be present in hexdump. What exactly is the hexdump ,objdump and coredump and what is their importance?

View 1 Replies View Related

Programming :: Difference Between Struct And Union?

Nov 6, 2010

I have been spending time (starting yesterday) reverse-engineering GTK+ to get my programming skills up. I came across a struct in the headers (_GtkArg, which was then typedeffed into GtkArg) that includes a union in it that has pretty much the same properties as a struct. Then, there was a struct inside the union.

I'm confused. Just what is the difference between a union and a struct?

P.S. I am using GTK's native C programming language.

View 8 Replies View Related

Programming :: Difference Between Setup_irq And Request_irq?

Feb 1, 2011

difference between setup_irq and request_irq and if there is a difference is there a way to use request_irq instead of setup_irq in this module?

[URL]

View 7 Replies View Related

Programming :: Difference Between Two Arithmetic Pointers

Jun 1, 2010

What is the difference between *ptr++ and (*ptr)++. In my opinion the terminology is all over the place so if you could give an example it would be better.

View 8 Replies View Related

Programming :: Difference Between Various Symbols Of Kernel

Aug 22, 2010

I was going through some exercise given in my school. I have read the C book but I am not able to understand some part. That is static variable. What exactly is a static variable and what does it do? I saw in Linux Kernel Programming external and exported are also some thing. I am not getting the difference between static,EXPORT_SYMBOL,external variable types. If I make a kernel module then how will I make sure that my variable is visible to the kernel. Is this what it is all talking about? I have checked this page [URL].

View 2 Replies View Related

Programming :: Difference Between PHP Echo() And Print()?

Dec 1, 2010

What's the difference between PHP echo() and PHP print(), especially in the execution time?

View 6 Replies View Related

Programming :: Difference Between Two Find Commands?

Dec 27, 2009

Code:

find . -name *.txt

Code:

find . -name *.txt

View 10 Replies View Related

Programming :: Difference Between Xlib And OpenGL?

Dec 6, 2008

I am starting to learn Linux graphical programming. Most of codes in my hands were written based on xlib, which is a kind of old graphic lib. I see some developers more interested in openGL. Then what's the difference between xlib and openGL? And which one is more popular used in which industry area?

View 2 Replies View Related

Programming :: __init() And Module_init() - What's The Difference

May 16, 2011

__init() and module_init() - What's the difference

View 3 Replies View Related

Ubuntu :: USB Mic Recognized, No Sound Recorded?

Sep 16, 2010

I recently switched to Ubuntu and I'm loving it, except i am having sound problems with both my laptop and my desktop.My laptop is using an internal microphone (it is a Toshiba Satellite P500) but the mic is not recognized, I hook up my M-Audio USB audio interface which has my studio mic connected to it, it gets recognized as an input device but it doesnt recordSame thing on my desktop, it gets recognized, doesnt record.My laptop is 64-bit and my desktop is 32-bit, both have Ubuntu 10.04

View 2 Replies View Related

Applications :: Playing CD That Was Recorded With Audacity?

May 6, 2010

Using Debian Lenny I recorded a wav file with Audacity to burn to a cd with K3b.The problem is when I played the cd with KsCD; it wouldn't stop when it got to the end; it just kept studdering. I didn't have problems using KsCD to play CDs I had ripped and then burned with K3b.Is this a problem with KsCD, or do I need to do something when I finish the file with Audacity?

View 7 Replies View Related

Software :: Playing CDs Recorded With Audacity?

May 10, 2010

I recorded some clips on the internet through the sound card withAudacity. I exported the recording as a wave file, and burnt it to a CD. The problem is stop playing. It comes to the end and just repeats the last fraction of a second over and over.I used K3b to burn other audio CDs that I copied and didn't havea problem with KsCD playing them. Is this a problem with Audacity,KsCD or did I do something wrong?I recorded the file; saved project and then exported as a wave file

View 3 Replies View Related

Programming :: Performance Difference Between 32bit And 64bit

Apr 10, 2010

Now, I'm ready to run my program, and my code is based on 32bit version. So I run the program on Ubuntu 9.10 32bit. And I got running time for 48s. But that's a bit slower than I expected; the program has bunch of File I/O processing but the result(48s) just doesn't make sense compared to given initial data set. So I just run the same program and same initial data set on Ubuntu 9.10 64bit ver. Then, bang!! it took 1.4s to finish the job.

Do you have any thoughts what kind of fact might make this significant difference? The differences b/w those two OS are "32 vs 64" and 32bit version has Java SDK, Eclipse, Apache2, Mysql, PHP, CGI, and python. We-server service is running but because I'm not really running web server. Did the result come from these background programs?

-- I tested it on the both OS in the same situation as possible as I can.
(reboot->test)

-- BTW 64bit one doesn't have those programs. I just installed on my external hard drive, so it's literary PURE one. (32bit one also in the same HDD)

-- I run these Ubuntus on VMware

View 3 Replies View Related

Programming :: Difference Between Shell And Bash Scripts?

Sep 25, 2010

Whats the difference, and when do you use which?

View 2 Replies View Related

General :: Difference In C Programming In Gedit & Turbo C?

Sep 6, 2010

In our college all the systems (running on windows xp) have TURBO C/C++ installed on them which we use for C programming. I recently installed ubuntu 10.04 on me laptop (DELL Inspiron 14R (N4010) with some modifications) i read somewhere on the internet that Gedit can be used for writing a programme in ubuntu which can be compiled using gcc. Well if i use Gedit rather than Turbo c will i experience any differnce?, i mean is there any problem in doing so?? Or i should prefer running turbo c using DOS BOX?

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved