root / src / Ganeti / Cpu / Types.hs @ 9d049fb4
History | View | Annotate | Download (1.8 kB)
1 |
{-# LANGUAGE TemplateHaskell #-} |
---|---|
2 |
{-| CPUload data types |
3 |
|
4 |
This module holds the definition of the data types describing the CPU |
5 |
load according to information collected periodically from @/proc/stat@. |
6 |
|
7 |
-} |
8 |
{- |
9 |
|
10 |
Copyright (C) 2013 Google Inc. |
11 |
|
12 |
This program is free software; you can redistribute it and/or modify |
13 |
it under the terms of the GNU General Public License as published by |
14 |
the Free Software Foundation; either version 2 of the License, or |
15 |
(at your option) any later version. |
16 |
|
17 |
This program is distributed in the hope that it will be useful, but |
18 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 |
General Public License for more details. |
21 |
|
22 |
You should have received a copy of the GNU General Public License |
23 |
along with this program; if not, write to the Free Software |
24 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
25 |
02110-1301, USA. |
26 |
|
27 |
-} |
28 |
module Ganeti.Cpu.Types |
29 |
( CPUstat(..) |
30 |
, CPUavgload(..) |
31 |
) where |
32 |
|
33 |
import Ganeti.THH |
34 |
|
35 |
-- | This is the format of the report produced by the cpu load |
36 |
-- collector. |
37 |
$(buildObject "CPUavgload" "cav" |
38 |
[ simpleField "cpu_number" [t| Int |] |
39 |
, simpleField "cpus" [t| [Double] |] |
40 |
, simpleField "cpu_total" [t| Double |] |
41 |
]) |
42 |
|
43 |
-- | This is the format of the data parsed by the input file. |
44 |
$(buildObject "CPUstat" "cs" |
45 |
[ simpleField "name" [t| String |] |
46 |
, simpleField "user" [t| Int |] |
47 |
, simpleField "nice" [t| Int |] |
48 |
, simpleField "system" [t| Int |] |
49 |
, simpleField "idle" [t| Int |] |
50 |
, simpleField "iowait" [t| Int |] |
51 |
, simpleField "irq" [t| Int |] |
52 |
, simpleField "softirq" [t| Int |] |
53 |
, simpleField "steal" [t| Int |] |
54 |
, simpleField "guest" [t| Int |] |
55 |
, simpleField "guest_nice" [t| Int |] |
56 |
]) |