mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2006-04-26, 12:34   #1
T.Rex
 
T.Rex's Avatar
 
Feb 2004
France

22·229 Posts
Default Too many gettimeofday() within mprime ?!

On Linux, using "strace -p <mprime-PID>", I got the following.
There are a dozen or more calls to gettimeofday() every second.
Maybe there is some possible performance improvement there.
T.


Code:
...
gettimeofday({1146054495, 848413}, {4294967176, 0}) = 0
gettimeofday({1146054495, 931584}, {4294967176, 0}) = 0
gettimeofday({1146054495, 931765}, {4294967176, 0}) = 0
gettimeofday({1146054496, 11979}, {4294967176, 0}) = 0
gettimeofday({1146054496, 12155}, {4294967176, 0}) = 0
gettimeofday({1146054496, 92190}, {4294967176, 0}) = 0
time([1146054496])                      = 1146054496
gettimeofday({1146054496, 92558}, {4294967176, 0}) = 0
gettimeofday({1146054496, 175913}, {4294967176, 0}) = 0
gettimeofday({1146054496, 176095}, {4294967176, 0}) = 0
gettimeofday({1146054496, 256532}, {4294967176, 0}) = 0
gettimeofday({1146054496, 256708}, {4294967176, 0}) = 0
gettimeofday({1146054496, 339884}, {4294967176, 0}) = 0
gettimeofday({1146054496, 340067}, {4294967176, 0}) = 0
gettimeofday({1146054496, 420334}, {4294967176, 0}) = 0
gettimeofday({1146054496, 420510}, {4294967176, 0}) = 0
gettimeofday({1146054496, 501056}, {4294967176, 0}) = 0
gettimeofday({1146054496, 501229}, {4294967176, 0}) = 0
gettimeofday({1146054496, 581272}, {4294967176, 0}) = 0
gettimeofday({1146054496, 581449}, {4294967176, 0}) = 0
gettimeofday({1146054496, 661825}, {4294967176, 0}) = 0
gettimeofday({1146054496, 662002}, {4294967176, 0}) = 0
gettimeofday({1146054496, 743024}, {4294967176, 0}) = 0
gettimeofday({1146054496, 743207}, {4294967176, 0}) = 0
gettimeofday({1146054496, 823464}, {4294967176, 0}) = 0
gettimeofday({1146054496, 823641}, {4294967176, 0}) = 0
gettimeofday({1146054496, 903780}, {4294967176, 0}) = 0
gettimeofday({1146054496, 903955}, {4294967176, 0}) = 0
gettimeofday({1146054496, 984071}, {4294967176, 0}) = 0
gettimeofday({1146054496, 984248}, {4294967176, 0}) = 0
gettimeofday({1146054497, 64298}, {4294967176, 0}) = 0
gettimeofday({1146054497, 64486}, {4294967176, 0}) = 0
gettimeofday({1146054497, 147771}, {4294967176, 0}) = 0
gettimeofday({1146054497, 147954}, {4294967176, 0}) = 0
gettimeofday({1146054497, 228350}, {4294967176, 0}) = 0
gettimeofday({1146054497, 228527}, {4294967176, 0}) = 0
gettimeofday({1146054497, 308707}, {4294967176, 0}) = 0
gettimeofday({1146054497, 308883}, {4294967176, 0}) = 0
gettimeofday({1146054497, 389138}, {4294967176, 0}) = 0
gettimeofday({1146054497, 389315}, {4294967176, 0}) = 0
....
T.Rex is offline   Reply With Quote
Old 2006-04-26, 16:00   #2
ColdFury
 
ColdFury's Avatar
 
Aug 2002

14016 Posts
Default

Quote:
Maybe there is some possible performance improvement there.
I doubt it consumes any significant percentage of the execution time
ColdFury is offline   Reply With Quote
Old 2006-04-26, 16:04   #3
TheJudger
 
TheJudger's Avatar
 
"Oliver"
Mar 2005
Germany

111110 Posts
Default

noticed that, too..
seems that gettimeofday() is called twice per iteration...

let me guess: your "Per iteration time" one the system where you generated that output above is about 80ms? ;)
TheJudger is offline   Reply With Quote
Old 2006-04-26, 16:27   #4
Greenbank
 
Greenbank's Avatar
 
Jul 2005

2×193 Posts
Default

Calls to gettimeofday are *VERY* cheap, it's usually implemented as a instruction to copy a timer into a register.

I knocked up a quick program that calls gettimeofday() twice in a row (to separate result buffers).

The total difference in returned values for 10M iterations is 4951681 microseconds.

So each call takes approximately 1/2 a microsecond.

So you'll need to call it 20M times before you use up 1 second of CPU time.
Greenbank is offline   Reply With Quote
Old 2006-04-26, 21:21   #5
T.Rex
 
T.Rex's Avatar
 
Feb 2004
France

22·229 Posts
Default

OK! OK! I've understood this is not a performance problem. Sorry.
"about 80ms?" I think it is 88ms on this machine.
Regards,
T.
T.Rex is offline   Reply With Quote
Old 2006-04-27, 09:10   #6
Greenbank
 
Greenbank's Avatar
 
Jul 2005

1100000102 Posts
Default

Quote:
Originally Posted by T.Rex
OK! OK! I've understood this is not a performance problem. Sorry.
"about 80ms?" I think it is 88ms on this machine.
Regards,
T.
No need to apologise, it's a valid question. I know I've seen similar things in other software only to be educated on the matter. ;-)
Greenbank is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
mPrime over SSH Vincanis Information & Answers 4 2011-06-30 13:36
./mprime -B in 257 Lazlow PrimeNet 3 2008-10-29 20:40
64 bit mprime? aaronl Linux 1 2005-11-10 16:50
ECM using gmp-ecm and mprime on a P4 geoff Factoring 60 2004-12-02 07:16
Problem with mprime (Fixed with mprime -d) antiroach Software 2 2004-07-19 04:07

All times are UTC. The time now is 22:51.


Fri Aug 6 22:51:34 UTC 2021 up 14 days, 17:20, 1 user, load averages: 3.92, 4.07, 3.90

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.