cpu_graph_page_view.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_HUD_DISPLAY_CPU_GRAPH_PAGE_VIEW_H_
  5. #define ASH_HUD_DISPLAY_CPU_GRAPH_PAGE_VIEW_H_
  6. #include "ash/hud_display/graph.h"
  7. #include "ash/hud_display/graph_page_view_base.h"
  8. namespace ash {
  9. namespace hud_display {
  10. // Draws CPU graphs;
  11. class CpuGraphPageView : public GraphPageViewBase {
  12. public:
  13. METADATA_HEADER(CpuGraphPageView);
  14. explicit CpuGraphPageView(const base::TimeDelta refresh_interval);
  15. CpuGraphPageView(const CpuGraphPageView&) = delete;
  16. CpuGraphPageView& operator=(const CpuGraphPageView&) = delete;
  17. ~CpuGraphPageView() override;
  18. // views::View
  19. void OnPaint(gfx::Canvas* canvas) override;
  20. // Update page data from the new snapshot.
  21. void UpdateData(const DataSource::Snapshot& snapshot) override;
  22. private:
  23. // Stacked, percent of CPU ticks per interval:
  24. Graph cpu_other_;
  25. Graph cpu_system_;
  26. Graph cpu_user_;
  27. Graph cpu_idle_;
  28. };
  29. } // namespace hud_display
  30. } // namespace ash
  31. #endif // ASH_HUD_DISPLAY_CPU_GRAPH_PAGE_VIEW_H_