cpufreq.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Licensed to the public under the Apache License 2.0. */
  2. 'use strict';
  3. 'require baseclass';
  4. 'require uci';
  5. return baseclass.extend({
  6. title: _('CPU Frequency'),
  7. rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
  8. var cpufreq = {
  9. title: "%H: Processor frequency - core %pi",
  10. alt_autoscale: true,
  11. vlabel: "Frequency (Hz)",
  12. number_format: "%3.2lf%s",
  13. data: {
  14. types: [ "cpufreq" ],
  15. options: {
  16. cpufreq: { color: "ff0000", title: "Frequency" },
  17. }
  18. }
  19. };
  20. if (uci.get("luci_statistics", "collectd_cpufreq", "ExtraItems")) {
  21. var transitions = {
  22. detail: true,
  23. title: "%H: Frequency transitions - core %pi",
  24. alt_autoscale: true,
  25. y_min: "0",
  26. y_max: "2",
  27. vlabel: "Transitions",
  28. number_format: "%3.2lf%s",
  29. data: {
  30. types: [ "transitions" ],
  31. options: {
  32. transitions: { color: "0000ff", title: "Transitions", noarea: true },
  33. }
  34. }
  35. };
  36. var percentage = {
  37. detail: true,
  38. title: "%H: Frequency distribution - core %pi",
  39. alt_autoscale: true,
  40. vlabel: "Percent",
  41. number_format: "%5.2lf%%",
  42. ordercolor: true,
  43. data: {
  44. types: [ "percent" ],
  45. options: {
  46. percent: { title: "%di kHz", negweight: true },
  47. }
  48. }
  49. };
  50. return [ cpufreq, percentage, transitions ];
  51. }
  52. else {
  53. return [ cpufreq ];
  54. }
  55. }
  56. });