[phobos] Is it possible to get Function Time in ticks like profiler give, but at runtime?

Jonathan M Davis jmdavisProg at gmx.com
Mon Aug 22 22:50:12 PDT 2011


On Sunday, August 21, 2011 05:21:02 unDEFER wrote:
> If you really want to understand my goal you can try to read my the next
> article (sorry for bad english):
> http://unde.sf.net/estimation-resources
> 
> If shortly I just want to estimate CPU using by program also as other
> resources like memory.
> I just try test `time` output (it prints user time and sys time for any
> program in Linux) for loaded and not loaded system and looks like that for
> Linux getrusage is what I need.
> As I understand there is no any universal methods to get this information
> for any OS?

There's pretty much nothing in terms of time-related functions - beyond C's 
time function - which exist on all OSes.  If you stick to just Posix, you do 
get a bit more - e.g. gettimeofday - but even then, it varies per OS pretty 
quickly. This is definitely the sort of thing that you're going to have to 
handle differently on each OS that you're working with.

- Jonathan M Davis


More information about the phobos mailing list