Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] timing for geeks :)
- Date: Fri, 2 Dec 2005 16:46:27 +0100
- From: Michal Hajek <hajek1@example.com>
- Subject: [tlug] timing for geeks :)
- User-agent: Mutt/1.5.9i
Hello :) I need a time mark in my experiments, so I have used ftime() function. But what was my surprise, when I discovered, that time mark for the _later_ measurements are actually more recent than _sooner_ measurements. Ok, I thought to myself, I am a poor programmer, most probubly I made a mystake. So I have written a very simple program and used it to test. I do not understand the result and here I come to the allmighty TLUGers [1] with a humble request for help.... So what I did exactly: 1. write a simple c program - see http://material.karlov.mff.cuni.cz/people/hajek/timetest/clocks.c 2. compile $:~/testcasu$ gcc -Wall -o cas clocks.c clocks.c:6: warning: return type defaults to 'int' clocks.c: In function 'main': clocks.c:11: warning: format '%d' expects type 'int', but argument 2 has type 'time_t' $:~/testcasu$ 3. well, only warnings, so let's see if it works :) 3. run it. $ cas > cas.txt here is the head of the file: 1133531643.784 1133531643.784 1133531643.784 1133531643.784 1133531643.784 1133531643.784 1133531643.784 1133531643.784 1133531643.784 1133531643.784 This beast writes to my disk with cca 21MB/s, so be carefull! 4. since many of the lines are same, lets uniq it :) uniq cas.txt > uniq.txt (I suspect the reason for all trobles comes in the above line) 5. produce time diferences between unique lines awk '{print $1, $1 - 1133531643.784}' uniq.txt > graf.dat 6. use gnuplot to produce graph. It graphse line number vs. time diff. http://material.karlov.mff.cuni.cz/people/hajek/timetest/uniq.png with detail on one peak: http://material.karlov.mff.cuni.cz/people/hajek/timetest/detail.png Can anyone please tell me why these peaks appear? Why there are three or more different slopes? How exactly does the program work than? More general question : is there other accurate time marker available in c-libraries? Above shown data were produced on debian amd64 pc with AMD Athlon(tm) 64 Processor 3000+ cpu MHz : 1872.184 bogomips : 3710.97 using distribution kernel: Linux 2.6.12-1-amd64-k8 #1 Wed Sep 28 02:31:26 CEST 2005 x86_64 GNU/Linux For me the practical impact right now is quite low or none at all, since for the actual measurement I can live with a bit slower rates, but ... once the question came to live, I cannot get rid of it ... So if someone is interested in this brain riddle, I would be quite interested in the answer :) Hmm, .. a good situation for a time contest.... so I offer a beer [2] for the first person who commes out with a solution :) [1] well, more precisely, to those who were allmighty enought to subscribe to this list :) [2] and perhaps you know that Czech beer [3] is the best beer in the world. [3] prize is to be taken in Prague, or wherever I would be at the particular moment [4] [4] recursion is not healthy! Best regards Michal
- Follow-Ups:
- Re: [tlug] timing for geeks
- From: Jim
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Aki Day???
- Next by Date: Re: [tlug] Mea Culpa
- Previous by thread: Re: [tlug] Video Clips
- Next by thread: Re: [tlug] timing for geeks
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links