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.
Export I_nsTime to ZScript.
Moderator: GZDoom Developers
-
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
Re: Export I_nsTime to ZScript.
This would be desirable too. Some of us do try to roll out our own profiling methods, and MSTime isn't very helpful.
-
-
- Posts: 3816
- Joined: Sun Aug 07, 2011 4:32 am
Re: Export I_nsTime to ZScript.
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.
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.
-
- Lead GZDoom+Raze Developer
- Posts: 49142
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Export I_nsTime to ZScript.
We do have floats, though.
How many nanoseconds fit into 53 bits?
How many nanoseconds fit into 53 bits?
-
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
Re: Export I_nsTime to ZScript.
I think that'd allow for up to 104 days before it wraps around (if I'm doing the math correctly).
-
- Lead GZDoom+Raze Developer
- Posts: 49142
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Export I_nsTime to ZScript.
It won't wrap around, though. It'll continue to count upwards but gradually lose precision.
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Export I_nsTime to ZScript.
Shouldnt it just stops incrementing?
I mean CPU will not be able to represent correctly result of addition 1 and 3*10^300, because all small ranked digits of a number would be outside of a number "scope".
I mean CPU will not be able to represent correctly result of addition 1 and 3*10^300, because all small ranked digits of a number would be outside of a number "scope".
-
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
Re: Export I_nsTime to ZScript.
I've opened a PR for this. As discussed I've made it return a double.
-
- Lead GZDoom+Raze Developer
- Posts: 49142
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Export I_nsTime to ZScript.
Added MSTimeF instead