mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   Too many gettimeofday() within mprime ?! (https://www.mersenneforum.org/showthread.php?t=5783)

T.Rex 2006-04-26 12:34

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
....[/CODE]

ColdFury 2006-04-26 16:00

[QUOTE]Maybe there is some possible performance improvement there.
[/QUOTE]

I doubt it consumes any significant percentage of the execution time

TheJudger 2006-04-26 16:04

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? ;)

Greenbank 2006-04-26 16:27

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.

T.Rex 2006-04-26 21:21

OK! OK! I've understood this is not a performance problem. Sorry.
"about 80ms?" I think it is 88ms on this machine.
Regards,
T.

Greenbank 2006-04-27 09:10

[QUOTE=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.[/QUOTE]

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. ;-)


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

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