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?

On Sun, 21 Aug 2011 03:58:26 +0400, Jonathan M Davis <[email protected]> wrote:

If you're looking to time how long a function takes to call, then use
std.datetime.benchmark. If you're looking to determine how much your specific
program calls a particular function and how much time it spends in that
function, then compile with -profile, run the program, and then look at the
files that it generates. If you want to do the equivalent of -profile at
runtime, I don't think that that's really possible, and I'm not quite sure why you'd want to. But even if you could, it would affect the performance of the program and probably skew the results anyway. It would certainly slow down the
program a lot. I suppose that you could write a wrapper function for your
specific function, time the exact time that it takes on each call with
std.datetime.StopWatch, and then send that information to another process via
std.socket if you really want something like that. But that sort of thing
sounds rather complicated to me, and I have no idea what good the information would do you at runtime anyway. Usually, the reason that people want to profile code is to determine what code they need to optimize make the program faster,
and -profile is plenty for that.

- Jonathan M Davis

--
Nikolay Krivchenkov aka unDEFER
I want to believe... in unDE.su
registered Linux user #360474
Don't worry, I can read OpenOffice.org/Libre Office/Lotus Symphony documents
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to