66public class Monitor.SystemMemoryView : Monitor .WidgetResource {
77 private Chart memory_chart;
88 private Memory memory;
9+ private Swap swap;
910
1011 private LabelRoundy memory_buffered_label = new LabelRoundy (_(" Buffered" ));
1112 private LabelRoundy memory_cached_label = new LabelRoundy (_(" Cached" ));
1213 private LabelRoundy memory_locked_label = new LabelRoundy (_(" Locked" ));
1314 private LabelRoundy memory_total_label = new LabelRoundy (_(" Total" ));
1415 private LabelRoundy memory_used_label = new LabelRoundy (_(" Used" ));
1516 private LabelRoundy memory_shared_label = new LabelRoundy (_(" Shared" ));
17+ private LabelRoundy swap_total_label = new LabelRoundy (_(" Swap Total" ));
18+ private LabelRoundy swap_used_label = new LabelRoundy (_(" Swap Used" ));
1619
1720 construct {
1821 title = (_(" Memory" ));
1922
2023 }
2124
22- public SystemMemoryView (Memory _memory ) {
25+ public SystemMemoryView (Memory _memory , Swap _swap ) {
2326 memory = _memory;
27+ swap = _swap;
2428
2529 memory_chart = new Chart (1 );
2630 memory_chart. set_serie_color (0 , Utils . Colors . get_rgba_color (Utils . Colors . LIME_300 ));
@@ -53,6 +57,8 @@ public class Monitor.SystemMemoryView : Monitor.WidgetResource {
5357 grid. attach (memory_buffered_label, 1 , 1 , 1 , 1 );
5458 grid. attach (memory_cached_label, 2 , 0 , 1 , 1 );
5559 grid. attach (memory_locked_label, 2 , 1 , 1 , 1 );
60+ grid. attach (swap_total_label, 3 , 0 , 1 , 1 );
61+ grid. attach (swap_used_label, 3 , 1 , 1 , 1 );
5662
5763 return grid;
5864 }
@@ -72,6 +78,9 @@ public class Monitor.SystemMemoryView : Monitor.WidgetResource {
7278 memory_locked_label. text = format_size ((uint64 ) memory. locked, IEC_UNITS );
7379
7480 memory_shared_label. text = format_size ((uint64 ) memory. shared, IEC_UNITS );
81+
82+ swap_total_label. text = format_size ((uint64 ) swap. total, IEC_UNITS );
83+ swap_used_label. text = format_size ((uint64 ) swap. used, IEC_UNITS );
7584 }
7685
7786}
0 commit comments