News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[patch] make profiling working again

Started by gerw, November 18, 2009, 05:45:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


prissi

#1
Apart from clock_gettime() not being available on Windows, the manpage states that it will not work properly on Multicors. Thus I think the time(NULL) should be rather kept.

Moreover, I want to do profiling without fast forward (for instance on graphic updates). Thus I took out the mandantory fast forward for profiling. The second ifdef is also not needed, since you will use profiling usually with a loaded game. Anyway, looking for quit_month seems a wiser choice here.

And without sync_step() and without fast forward, no vehicle will move at all (since this is done in the sync steps.)

Thank you for your changes, will go into the trunk then.

gerw

Thank you for your comments.

Quote from: prissi on November 18, 2009, 09:07:01 PM
Apart from clock_gettime() not being available on Windows, the manpage states that it will not work properly on Multicors. Thus I think the time(NULL) should be rather kept.
The problem is, that time(NULL) returns seconds and not milliseconds. I searched the internet and there seems to be no posix way to get milliseconds...


QuoteMoreover, I want to do profiling without fast forward (for instance on graphic updates). Thus I took out the mandantory fast forward for profiling. The second ifdef is also not needed, since you will use profiling usually with a loaded game. Anyway, looking for quit_month seems a wiser choice here.
Coupling the fast forward to the "until" is a good choice!

Spike

Quote from: gerw on November 19, 2009, 10:19:31 AM
Thank you for your comments.
The problem is, that time(NULL) returns seconds and not milliseconds. I searched the internet and there seems to be no posix way to get milliseconds...

Isn't there gettimeofday() ?

Edit: http://www.opengroup.org/onlinepubs/000095399/functions/gettimeofday.html

It seems so. Would that work?

skreyola

Quote from: gerw on November 19, 2009, 10:19:31 AM
Thank you for your comments.
The problem is, that time(NULL) returns seconds and not milliseconds. I searched the internet and there seems to be no posix way to get milliseconds...
Actually, I found something for a program I'm writing.
Here's the page that describes it: http://www.firstobject.com/getmillicount-milliseconds-portable-c++.htm
It works for me under Debian.
--Skreyola
You can also help translate for your language with SimuTranslator.