On Wed, May 8, 2013 at 9:13 PM, Stephan Beal <[email protected]> wrote:

> (pushed/popped via start()/stop()), but before i commit it i want to play
> with start() returning and ID and end() taking an ID, as opposed to
> requiring matching pairs, e.g.:
>

Yeah, i like that better:

http://fossil-scm.org/index.html/info/e28433a692

it is not currently exposed via th1, as the OP requested, but it lays some
generic groundwork for such an addition:

g.mainTimerId is now set to the ID of a timer started just before main()
starts doing its real work. The current elapsed uSeconds can be fetched
with:

sqlite3_uint64 delta = fossil_timer_fetch( g.mainTimerId )

Alternately, lower-level code can invoke their own timers:

int timerId = fossil_timer_start(); // == -1 on error
...
sqlite3_uint64 delta = fossil_timer_fetch( timerId ); // in uSeconds
or:
delta = fossil_timer_stop( timerId );

the stop() method "deallocates" the timer (so to say), making it free for
re-use (there is a hard-coded number of them available for app use,
currently 10).

PLEASE PLEASE PLEASE somebody test this on Windows! The timer code is a
refactored form of the timer code from th_main.c, so it "should work fine"
for Windows, but i don't have an environment to test it on.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to