c++ time() function performance in solaris -


we have multi-threaded c++ application running on solaris (5.10, sparc platform). per "pstack" of threads seem waiting on below call little long. corresponds "time_t currenttime = time(null) ;" function in application code current time in seconds.

ffffffff76cdbe1c __time (0, 23e8, 1dab58, ffffffff76c63508, ffffffff76e3e000, 2000) + 8 

the timezone "asia/riyadh". tried setting tz variable both "asia/riyadh" '<gmt+3>-3'. there no obvious improvement either option. changing server code (even if there alternative) rather difficult @ point. test program (single thread, compiled without -o2) having 1 million "time(null)" invocations came out rather quickly. application & test program compiled using gcc 4.5.1.

is there else can try out?

i agree rather broad question. try out valid suggestions , close there adequate improvement handle current load.

edit 1 :

please ignore reference time(null) above, possible cause __time stack. made inference based on signature, , finding same invocation in source method.

following stack leading __time.

ffffffff76cdbe1c __time (0, 23e8, 1dab58, ffffffff773e5cc0, ffffffff76e3e000, 2000) + 8 ffffffff76c9c7f0 getnow (ffffffff704fb180, ffffffff773c6384, 1a311c, 2, ffffffff76e4eae8, fffc00) + 4 ffffffff76c9af0c strptime_recurse (ffffffff76e4cea0, 1, 104980178,   ffffffff704fb938, ffffffff704fb180, ffffffff704fb1a4) + 34 ffffffff76c9dce8 __strptime_std (ffffffff76e4cea0, 10458b2d8, 104980178, ffffffff704fb938, 2400, 1a38ec) + 2c 

you (and we) not going able make time faster. message, gather calling many different threads @ once. may problem; it's quite possible solaris serializes these calls, end lot of threads waiting others complete.

how accuracy need? possible solution might have 1 thread loop on reading time, sleeping maybe 10 ms between each read, , putting results in global variable, other threads read. (don't forget you'll need synchronize accesses variable, unless have sort of atomic variables, std::atomic<time_t> in c++11.)


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -