Export I_nsTime to ZScript.

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Export I_nsTime to ZScript.

Postby Accensus » Thu Jun 10, 2021 10:56 am

I'm trying to use MSTime to benchmark a piece of code because there are too many other actors that run at the same time to be able to rely on stat vm, as it fluctuates too much. Unfortunately, I don't think MSTime offers me the precision I'm looking for. Would it be possible to export I_nsTime to ZScript as NSTime?

EDIT: a temporary workaround that got suggested to me is to run the suspected code in a loop. Not the most elegant solution, but it works. Still, having more precise numbers would be rad.
User avatar
Accensus
Vector, locked in.
 
Joined: 11 Feb 2016
Location: Somalia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Export I_nsTime to ZScript.

Postby Marisa Kirisame » Fri Jun 11, 2021 1:07 am

This would be desirable too. Some of us do try to roll out our own profiling methods, and MSTime isn't very helpful.
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Export I_nsTime to ZScript.

Postby _mental_ » Fri Jun 11, 2021 1:37 am

As we don't have 64-bit integers in ZScript, nanosecond resolution is out of question. Microseconds seem more acceptable, but still the counter wraps in less than 72 minutes. For performance profiling, it doesn't really matter.
However, there will always be some "exceptional" people who will use it in gameplay logic. And they will complain aloud that their "brilliant" mod ideas failed just because of this limitation.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Export I_nsTime to ZScript.

Postby Graf Zahl » Fri Jun 11, 2021 1:48 am

We do have floats, though.
How many nanoseconds fit into 53 bits?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Export I_nsTime to ZScript.

Postby Marisa Kirisame » Fri Jun 11, 2021 2:53 am

I think that'd allow for up to 104 days before it wraps around (if I'm doing the math correctly).
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Export I_nsTime to ZScript.

Postby Graf Zahl » Fri Jun 11, 2021 2:59 am

It won't wrap around, though. It'll continue to count upwards but gradually lose precision.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests