1=head1 NAME
2
3Unix::Statgrab::sg_cpu_stats - container for libstatgrab CPU statistics
4
5=head1 DESCRIPTION
6
7C<Unix::Statgrab::sg_cpu_stats> is a Perl package name providing
8accessors to bundled libstatgrab L<sg_cpu_stats|http://www.i-scream.org/libstatgrab/docs/sg_get_cpu_stats.3.html> data collection.
9
10=head1 METHODS
11
12=head2 nentries
13
14Returns the number of entries in the container.
15
16=head2 systime
17
18Returns the seconds since Epoch (0:00:00 on January, 1st 1970) of the time measure the CPU statistics.
19
20=head2 as_list
21
22B<Deprecated> alias of L</fetchall_hash>
23
24=head2 fetchall_hash
25
26Returns all records from L<sg_cpu_stats|http://www.i-scream.org/libstatgrab/docs/sg_get_cpu_stats.3.html>
27container as list of hash containing each datum name as key and the datum as value.
28
29=head2 fetchall_array
30
31Returns all records from L<sg_cpu_stats|http://www.i-scream.org/libstatgrab/docs/sg_get_cpu_stats.3.html>
32container as list of arrays containing the values in following order:
33
34  (user kernel idle iowait swap nice total
35   context_switches voluntary_context_switches involuntary_context_switches
36   syscalls interrupts soft_interrupts
37   systime)
38
39in that order without leading headline.
40
41=head2 fetchall_table
42
43Returns all records from L<sg_cpu_stats|http://www.i-scream.org/libstatgrab/docs/sg_get_cpu_stats.3.html>
44container as list of arrays containing the values in following order:
45
46  (user kernel idle iowait swap nice total
47   context_switches voluntary_context_switches involuntary_context_switches
48   syscalls interrupts soft_interrupts
49   systime)
50
51in that order including leading headline.
52
53=head2 fetchrow_arrayref($row = 0)
54
55Returns one row as array containing values as above.
56
57=head2 fetchall_arrayref
58
59Returns all records from L<sg_cpu_stats|http://www.i-scream.org/libstatgrab/docs/sg_get_cpu_stats.3.html>
60container as array of arrays without header.
61
62=head2 fetchrow_hashref($row = 0)
63
64Returns one row as hash containing C<< { user => $self.user($row), kernel => ... } >>.
65
66=head2 fetchall_hashref
67
68Returns all records from L<sg_cpu_stats|http://www.i-scream.org/libstatgrab/docs/sg_get_cpu_stats.3.html>
69container as array of hashes.
70
71=head2 colnames
72
73Returns list of column names: C<< (user kernel idle iowait swap nice total context_switches voluntary_context_switches involuntary_context_switches syscalls interrupts soft_interrupts systime) >>
74
75=head2 user
76
77Clock ticks in user mode
78
79=head2 kernel
80
81Clock ticks in kernel mode
82
83=head2 idle
84
85Clock ticks while idle
86
87=head2 iowait
88
89Clock ticks while waiting for outstanding I/O
90
91=head2 swap
92
93Clock ticks while waiting for swap
94
95=head2 nice
96
97Clock ticks in user mode with nice priority
98
99=head2 total
100
101Overall clock ticks
102
103=head2 context_switches
104
105Overall Context switches
106
107=head2 voluntary_context_switches
108
109Voluntary context switches (See L<sched_yield(2)|http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html>)
110
111=head2 involuntary_context_switches
112
113Involuntary context switches
114
115=head2 syscalls
116
117Number of syscalls
118
119=head2 interrupts
120
121Amount of interrupts happened
122
123=head2 soft_interrupts
124
125Amount of software triggered interrupts
126
127=head2 get_cpu_stats_diff
128
129Provides the difference between the last measurement and the recent one.
130
131  $recent->get_cpu_stats_diff($last);
132
133=head2 get_cpu_percents
134
135Provides a percentage representation of the single cpu ticks measured.
136
137=head1 AUTHOR
138
139Jens Rehsack, E<lt>rehsack AT cpan.orgE<gt>
140
141=head1 COPYRIGHT AND LICENSE
142
143Copyright (C) 2012-2018 by Jens Rehsack
144
145This library is free software; you can redistribute it and/or modify it under
146the terms of the GNU Lesser General Public License as published by the Free
147Software Foundation; either version 2.1 of the License, or (at your option) any
148later version.
149
150=cut
151