|
| 1 | +=begin pod |
| 2 | +
|
| 3 | +=TITLE class Telemetry::Period |
| 4 | +
|
| 5 | +=SUBTITLE Performance data over a period |
| 6 | +
|
| 7 | + class Telemetry::Period { } |
| 8 | +
|
| 9 | +A C<Telemetry::Period> object contains the difference between two C<Telemetry> |
| 10 | +objects. It is generally not created by calling .new, but it can be if needed: |
| 11 | +it takes "cpu-user", "cpu-sys" and "wallclock" as named parameters. |
| 12 | +
|
| 13 | +=begin code |
| 14 | +# basic usage |
| 15 | +use Telemetry; |
| 16 | +my $t0 = Telemetry.new; |
| 17 | +# execute some code |
| 18 | +my $t1 = Telemetry.new; |
| 19 | +my $period = $t1 - $t0; # creates Telemetry::Period object |
| 20 | +say "Code took $period (cpu / wallclock) microseconds to execute"; |
| 21 | +=end code |
| 22 | +
|
| 23 | +=head2 Data Methods |
| 24 | +
|
| 25 | +=item method affinity-tasks-completed |
| 26 | +
|
| 27 | +The number of tasks completed in affinity threads in this period. |
| 28 | +
|
| 29 | +=item method affinity-tasks-queued |
| 30 | +
|
| 31 | +The number of tasks queued for execution in affinity threads in this period. |
| 32 | +
|
| 33 | +=item method affinity-workers |
| 34 | +
|
| 35 | +The number of affinity threads added in this period. |
| 36 | +
|
| 37 | +=item method cpu |
| 38 | +
|
| 39 | +Returns the total amount of CPU time of this period (in microseconds), |
| 40 | +essentially the sum of C<cpu-user> and C<cpu-sys>. |
| 41 | +
|
| 42 | +=item method cpus |
| 43 | +
|
| 44 | +Returns the number of CPUs that were in full use on average in this period |
| 45 | +(basically L<cpu> divided by L<wallclock>). |
| 46 | +
|
| 47 | +=item method cpu-user |
| 48 | +
|
| 49 | +Returns the amount of CPU time spent on executing user code of this period |
| 50 | +(in microseconds). |
| 51 | +
|
| 52 | +=item method cpu-sys |
| 53 | +
|
| 54 | +Returns the amount of CPU time spent in system overhead of this period (in |
| 55 | +microseconds). |
| 56 | +
|
| 57 | +=item method general-tasks-completed |
| 58 | +
|
| 59 | +The number of tasks completed in general worker threads in this period. |
| 60 | +
|
| 61 | +=item method general-tasks-queued |
| 62 | +
|
| 63 | +The number of tasks queued for execution in general worker threads in this period. |
| 64 | +
|
| 65 | +=item method general-workers |
| 66 | +
|
| 67 | +The number of general worker threads that were added in this period. |
| 68 | +
|
| 69 | +=item method max-rss |
| 70 | +
|
| 71 | +Maximum resident set size increase for this period (in Kbytes). |
| 72 | +
|
| 73 | +=item method supervisor |
| 74 | +
|
| 75 | +The number of supervisor threads added in this period. |
| 76 | +
|
| 77 | +=item method timer-tasks-completed |
| 78 | +
|
| 79 | +The number of tasks completed in timer worker threads in this period. |
| 80 | +
|
| 81 | +=item method timer-tasks-queued |
| 82 | +
|
| 83 | +The number of tasks queued for execution in timer worker threads in this period. |
| 84 | +
|
| 85 | +=item method timer-workers |
| 86 | +
|
| 87 | +The number of timer worker threads that were added in this period. |
| 88 | +
|
| 89 | +=item method utilization |
| 90 | +
|
| 91 | +Returns the % of CPUs that were used on average in this period. |
| 92 | +
|
| 93 | +=item method wallclock |
| 94 | +
|
| 95 | +Returns the length of the period (in microseconds). |
| 96 | +
|
| 97 | +Apart from these data methods, other fields in the POSIX C<getrusage> struct |
| 98 | +are also available, but are probably not in use on most operating systems and |
| 99 | +will thus always give 0. These are: |
| 100 | +
|
| 101 | +id-rss, inblock, invcw, is-rss, ix-rss, maj-flt, min-flt, msgrcv, msgsnd, |
| 102 | +nsignals, nswap, nvcsw, outblock. |
| 103 | +
|
| 104 | +Please consult the C<getrusage> manual information for the meaning of these |
| 105 | +fields. |
| 106 | +
|
| 107 | +=head1 Other methods |
| 108 | +
|
| 109 | +=head2 method gist / method Str |
| 110 | +
|
| 111 | +Returns a string representation in the form "cpu / wallclock". |
| 112 | +
|
| 113 | +=head1 See Also |
| 114 | +
|
| 115 | +L<Telemetry> |
| 116 | +L<snapper> |
| 117 | +
|
| 118 | +=end pod |
0 commit comments