class_proc.inc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. // $Id: class_proc.inc,v 1.1 2002/12/29 16:19:36 dijkstra Exp $
  3. require_once("class_graph.inc");
  4. class PROC_Graph extends Graph {
  5. function PROC_Graph() {
  6. // get all the sensible defaults from our parent class
  7. $this->init();
  8. }
  9. function execute($url) {
  10. $this->url2options($url);
  11. // and add a few private things
  12. $this->graphsettings["rawcmdline"] .=" -v '% cpu proc(".$this->get("name").")' -u 100 --rigid ";
  13. $this->shortcut = array_merge($this->shortcut, array(
  14. "proc" => array(
  15. "brief" => array(
  16. "dsdefinition" => array(
  17. "DEF:pct=".$this->get("rrdfile").":cpupct:AVERAGE",
  18. "DEF:num=".$this->get("rrdfile").":number:AVERAGE",
  19. "CDEF:inum=0,num,-"),
  20. "graphdefinition" => array(
  21. "AREA:pct#00FF00:'cpupct'",
  22. "GPRINT:pct:AVERAGE:'%.0lf\g'",
  23. "AREA:inum#0000FF:'number'",
  24. "GPRINT:num:AVERAGE:'%.0lf\g'")),
  25. "detailed" => array(
  26. "dsdefinition" => array(
  27. "DEF:number=".$this->get("rrdfile").":number:AVERAGE",
  28. "DEF:uticks=".$this->get("rrdfile").":uticks:AVERAGE",
  29. "DEF:sticks=".$this->get("rrdfile").":sticks:AVERAGE",
  30. "DEF:iticks=".$this->get("rrdfile").":iticks:AVERAGE",
  31. "DEF:cpusec=".$this->get("rrdfile").":cpusec:AVERAGE",
  32. "DEF:cpupct=".$this->get("rrdfile").":cpupct:AVERAGE",
  33. "DEF:procsz=".$this->get("rrdfile").":procsz:AVERAGE",
  34. "DEF:rsssz=".$this->get("rrdfile").":rsssz:AVERAGE",
  35. "CDEF:null=number,number,-",
  36. "CDEF:inumber=0,number,-"),
  37. "graphdefinition" => array(
  38. 'COMMENT:" min avg max last\n"',
  39. "AREA:cpupct#00FF00:'cpupct '",
  40. 'GPRINT:cpupct:MIN:" %3.2lf %%"',
  41. 'GPRINT:cpupct:AVERAGE:"%3.2lf %%"',
  42. 'GPRINT:cpupct:MAX:"%3.2lf %%"',
  43. 'GPRINT:cpupct:LAST:"%3.2lf %%\n"',
  44. "AREA:inumber#0000FF:'number '",
  45. 'GPRINT:number:MIN:" %5.0lf "',
  46. 'GPRINT:number:AVERAGE:"%5.0lf "',
  47. 'GPRINT:number:MAX:"%5.0lf "',
  48. 'GPRINT:number:LAST:"%5.0lf \n"',
  49. "STACK:null#000000:'uticks '",
  50. 'GPRINT:uticks:MIN:" %3.2lf %s"',
  51. 'GPRINT:uticks:AVERAGE:"%3.2lf %s"',
  52. 'GPRINT:uticks:MAX:"%3.2lf %s"',
  53. 'GPRINT:uticks:LAST:"%3.2lf %s\n"',
  54. "STACK:null#000000:'sticks '",
  55. 'GPRINT:sticks:MIN:" %3.2lf %s"',
  56. 'GPRINT:sticks:AVERAGE:"%3.2lf %s"',
  57. 'GPRINT:sticks:MAX:"%3.2lf %s"',
  58. 'GPRINT:sticks:LAST:"%3.2lf %s\n"',
  59. "STACK:null#000000:'iticks '",
  60. 'GPRINT:iticks:MIN:" %3.2lf %s"',
  61. 'GPRINT:iticks:AVERAGE:"%3.2lf %s"',
  62. 'GPRINT:iticks:MAX:"%3.2lf %s"',
  63. 'GPRINT:iticks:LAST:"%3.2lf %s\n"',
  64. "STACK:null#000000:'cpusec '",
  65. 'GPRINT:cpusec:MIN:" %5.0lf "',
  66. 'GPRINT:cpusec:AVERAGE:"%5.0lf "',
  67. 'GPRINT:cpusec:MAX:"%5.0lf "',
  68. 'GPRINT:cpusec:LAST:"%5.0lf \n"',
  69. "STACK:null#000000:'procsz '",
  70. 'GPRINT:procsz:MIN:" %3.2lf %s"',
  71. 'GPRINT:procsz:AVERAGE:"%3.2lf %s"',
  72. 'GPRINT:procsz:MAX:"%3.2lf %s"',
  73. 'GPRINT:procsz:LAST:"%3.2lf %s\n"',
  74. "STACK:null#000000:'rsssz '",
  75. 'GPRINT:rsssz:MIN:" %3.2lf %s"',
  76. 'GPRINT:rsssz:AVERAGE:"%3.2lf %s"',
  77. 'GPRINT:rsssz:MAX:"%3.2lf %s"',
  78. 'GPRINT:rsssz:LAST:"%3.2lf %s\n"')))));
  79. $this->graphdefaults = array_merge($this->graphdefaults,
  80. $this->shortcut["proc"]["brief"]);
  81. $this->url2options($url);
  82. }
  83. }
  84. ?>