The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: gerw on November 18, 2009, 05:45:26 pm

Title: [patch] make profiling working again
Post by: gerw on November 18, 2009, 05:45:26 pm
Due to the network code, the profiling is broken.

http://www-user.tu-chemnitz.de/~gerw/patches/2870_profiling_again.patch (http://www-user.tu-chemnitz.de/~gerw/patches/2870_profiling_again.patch)
Title: Re: [patch] make profiling working again
Post by: 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.

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.
Title: Re: [patch] make profiling working again
Post by: gerw on November 19, 2009, 10:19:31 am
Thank you for your comments.

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...


Quote
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.
Coupling the fast forward to the "until" is a good choice!
Title: Re: [patch] make profiling working again
Post by: Spike on November 19, 2009, 11:22:11 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?
Title: Re: [patch] make profiling working again
Post by: skreyola on November 19, 2009, 05:21:46 pm
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.