diff options
author | jdamanalo <jamanalo5@up.edu.ph> | 2022-11-24 21:01:26 +0800 |
---|---|---|
committer | jdamanalo <jamanalo5@up.edu.ph> | 2022-11-28 14:19:00 +0800 |
commit | a2265b5d9ccbdf866be5eaf583eaf683e19d4893 (patch) | |
tree | 1789269fc1fc8c72c2d379ad1eac1fd5baa77b2d /lib/stdlib/doc | |
parent | d713e274781b2e344c7f8e7bbc064281d71eeefc (diff) | |
download | erlang-a2265b5d9ccbdf866be5eaf583eaf683e19d4893.tar.gz |
stdlib/timer: better resolution control
- added a final `erlang:time_unit()` argument to `tc/[1,2,3]`
Tackles #3264. Primarily for systems with worse resolution than a microsecond.
Diffstat (limited to 'lib/stdlib/doc')
-rw-r--r-- | lib/stdlib/doc/src/timer.xml | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/lib/stdlib/doc/src/timer.xml b/lib/stdlib/doc/src/timer.xml index 2cbf7977a9..6f3aef8c7e 100644 --- a/lib/stdlib/doc/src/timer.xml +++ b/lib/stdlib/doc/src/timer.xml @@ -319,14 +319,37 @@ <func> <name name="tc" arity="1" since="OTP R14B03"/> - <name name="tc" arity="2" since="OTP R14B"/> - <name name="tc" arity="3" since=""/> + <name name="tc" arity="2" clause_i="1" since="OTP R14B"/> + <name name="tc" arity="3" clause_i="1" since=""/> + <fsummary>Measure the real time it takes to evaluate <c>Fun</c>.</fsummary> + <desc> + <taglist> + <tag><c>tc/3</c></tag> + <item> + <p>Calls function <c>timer:tc(Module, Function, Arguments, microsecond)</c>.</p> + </item> + <tag><c>tc/2</c></tag> + <item> + <p>Calls function <c>timer:tc(Fun, Arguments, microsecond)</c>.</p> + </item> + <tag><c>tc/1</c></tag> + <item> + <p>Calls function <c>timer:tc(Fun, microsecond)</c>.</p> + </item> + </taglist> + </desc> + </func> + + <func> + <name name="tc" arity="2" clause_i="2" since=""/> + <name name="tc" arity="3" clause_i="2" since=""/> + <name name="tc" arity="4" since=""/> <fsummary>Measure the real time it takes to evaluate <c>apply(Module, Function, Arguments)</c> or <c>apply(Fun, Arguments)</c>.</fsummary> - <type_desc variable="Time">In microseconds</type_desc> + <type_desc variable="Time">In the specified <c>TimeUnit</c></type_desc> <desc> <taglist> - <tag><c>tc/3</c></tag> + <tag><c>tc/4</c></tag> <item> <p>Evaluates <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Arguments</anno>)</c> and measures the elapsed real time as @@ -334,18 +357,18 @@ <c>erlang:monotonic_time/0</c></seemfa>.</p> <p>Returns <c>{<anno>Time</anno>, <anno>Value</anno>}</c>, where <c><anno>Time</anno></c> is the elapsed real time in - <em>microseconds</em>, and <c><anno>Value</anno></c> is what is + the specified <c>TimeUnit</c>, and <c><anno>Value</anno></c> is what is returned from the apply.</p> </item> - <tag><c>tc/2</c></tag> + <tag><c>tc/3</c></tag> <item> <p>Evaluates <c>apply(<anno>Fun</anno>, <anno>Arguments</anno>)</c>. - Otherwise the same as <c>tc/3</c>.</p> + Otherwise the same as <c>tc/4</c>.</p> </item> - <tag><c>tc/1</c></tag> + <tag><c>tc/2</c></tag> <item> <p>Evaluates <c><anno>Fun</anno>()</c>. Otherwise the same as - <c>tc/2</c>.</p> + <c>tc/3</c>.</p> </item> </taglist> </desc> |