Download
(20 Kb)
Download
Updated: 07-12-13 08:01 PM
Updated:07-12-13 08:01 PM
Created:11-07-11 09:42 PM
Downloads:680
Favorites:2
MD5:
LibPerfORate
Version: 0.7
by: seebs [More]
Lib Perf-O-Rate is the performance measuring utility you always wanted. Well. It's the utility *I* always wanted.

Perf-O-Rate doesn't measure CPU time, but what it DOES do is let you request summaries of usage by tag -- note that the addon API already gives you a fairly good version of this in the Inspect.AddOn.CPU() output. The primary usages:

1. /perf -b "expr" will run expr 100 times (once per update, so this will take a bit) and tell you how long it took.
2. In code, perf.hook(func, name) returns a function f, such that f(args) is equivalent to func(args), but the real time that passes during the evaluation is accumulated under the tag <name>.

So if you wanted to find out what one of your hooks is consuming for CPU time, replace it with perf.hook(func, "foo"), then run "/perf foo". Note that you can reset the timer ("/perf -r foo") if you'd like to start over from a given point.

This is young and experimental. Breaking changes could be in the pipeline.

Embeds my LibGetOpt, so it actually supports quoting for expr (only " and \ quoting at this time, mind).

BTW, I did some meta-testing on the performance of the hooks. It looks like running a function inside the hooks takes on the order of 0.8 milliseconds, which isn't super fast, but it should be small enough that you can have a few things hooked and not suffer horribly.
Added lap timer and elapsed time report feature.

0.3/0.4: ToC updates, improved reporting.
0.5: ToC updates.
0.6: Fix reset (perf -r) so it works, automatically reset a benchmark after running it so you don't accumulate old statistics.
0.7: Event API changes.
Optional Files (0)


Archived Files (5)
File Name
Version
Size
Author
Date
0.6
19kB
seebs
12-16-12 09:11 PM
0.5
19kB
seebs
11-03-12 01:35 AM
0.4
12kB
seebs
06-22-12 09:53 PM
0.2
10kB
seebs
11-08-11 06:59 PM
0.1
9kB
seebs
11-07-11 09:42 PM


There have been no comments posted to this file.
Be the first to add one.



Category Jump: