Test2:...:Times(3perl)
π Test2::Util::Times π β the Test2::Util::Times page from the Perl Programmers Reference Guide
okay bestie, gather round, because this is the little module that makes your test output go from "meh" to "slay" β¨
πΈ NAME πΈ
Test2::Util::Times β it formats timing/benchmark info for you π
β¨ DESCRIPTION β¨
So like, this module exports tools for rendering timing data at the end of your tests. That's the whole vibe. It takes your numbers and turns them into something pretty. π
π¦ EXPORTS π¦
Okay so important thing first: all exports are optional. Which means the module isn't just gonna throw subs at you β you must specify subs to import. No sneaky auto-imports here, you're the main character, you choose. π
$str = render_bench($start, $end, $user, $system, $cuser, $csystem)
$str = render_bench($start, time(), times())
This bad boy π«Ά will produce a string like one of the ones below (and heads up, these numbers are completely made up β do not come for me, they are fictional bestie). Which string you get depends on the time elapsed.
0.12345s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)
11.1234s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)
01m:54.45s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)
18h:22m:54.45s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)
04d:18h:22m:54.45s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)
See how it levels up? seconds β minutes β hours β days. It's giving character development. πβ¨
Now the deets on the args, because you know I'd never leave you hanging:
- The first 2 arguments are the
$startand$endtimes in seconds β like, exactly what you'd get back fromtime()orTime::HiRes::time()β±οΈ - The last 4 arguments are timing info as returned by the
times()function π
π SOURCE π
The source code repo for Test2-Suite lives at https://github.com/Test-More/test-more/. Go be nosy, you're allowed π«Ά
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
β AUTHORS β
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
k that's the whole page bestie, no notes π
okay bye ily, this was perl v5.44.0, dated 2026-10-17, and it lives at Test2::Util::Times(3perl) β periodt ππΈπ¦
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms