diff options
-rw-r--r-- | PTS-12-CHANGE-LOG | 1 | ||||
-rw-r--r-- | pts-core/modules/system_monitor.php | 2 | ||||
-rw-r--r-- | pts-core/objects/pts_LineGraph.php | 12 | ||||
-rw-r--r-- | pts-core/objects/pts_module.php | 3 |
4 files changed, 10 insertions, 8 deletions
diff --git a/PTS-12-CHANGE-LOG b/PTS-12-CHANGE-LOG index 22a6fb8..7afca26 100644 --- a/PTS-12-CHANGE-LOG +++ b/PTS-12-CHANGE-LOG @@ -8,3 +8,4 @@ - system_monitor: Poll sensors every 30 seconds during testing - Add CPU usage monitoring support to pts-core - system_monitor: Add cpu.usage to MONITOR, fix some bugs as well +- pts_LineGraph: Don't display the pointers if there are too many points on the graph diff --git a/pts-core/modules/system_monitor.php b/pts-core/modules/system_monitor.php index 5969a6f..456c440 100644 --- a/pts-core/modules/system_monitor.php +++ b/pts-core/modules/system_monitor.php @@ -112,7 +112,7 @@ class system_monitor extends pts_module_interface pts_module::save_file(".s/CPU_USAGE"); } - pts_module::pts_timed_function(30, "pts_monitor_update"); + pts_module::pts_timed_function(5, "pts_monitor_update"); } public static function __shutdown($obj = NULL) { diff --git a/pts-core/objects/pts_LineGraph.php b/pts-core/objects/pts_LineGraph.php index fce72d2..958ce56 100644 --- a/pts-core/objects/pts_LineGraph.php +++ b/pts-core/objects/pts_LineGraph.php @@ -63,7 +63,8 @@ class pts_LineGraph extends pts_CustomGraph $previous_offset = -1; $paint_color = $this->next_paint_color(); - for($i = 0; $i < count($this->graph_data[$i_o]); $i++) + $point_counter = count($this->graph_data[$i_o]); + for($i = 0; $i < $point_counter; $i++) { $value = $this->graph_data[$i_o][$i]; $value_plot_top = $this->graph_top_end + 1 - round(($value / $this->graph_maximum_value) * ($this->graph_top_end - $this->graph_top_start)); @@ -72,13 +73,14 @@ class pts_LineGraph extends pts_CustomGraph if($previous_placement != -1 && $previous_offset != -1) { imageline($this->graph_image, $previous_offset, $previous_placement, $px_from_left, $value_plot_top, $paint_color); - $this->render_graph_pointer($previous_offset, $previous_placement); + if($point_counter < 26) + $this->render_graph_pointer($previous_offset, $previous_placement); } - if($i == count($this->graph_data[$i_o]) - 1) + if($i == 0 || $i == count($this->graph_data[$i_o]) - 1) $this->render_graph_pointer($px_from_left, $value_plot_top); - $previous_placement = $value_plot_top; - $previous_offset = $px_from_left; + $previous_placement = $value_plot_top; + $previous_offset = $px_from_left; } } diff --git a/pts-core/objects/pts_module.php b/pts-core/objects/pts_module.php index 0a1f12c..18a8a01 100644 --- a/pts-core/objects/pts_module.php +++ b/pts-core/objects/pts_module.php @@ -84,7 +84,6 @@ class pts_module if(($extra_dir = dirname($to_file)) != "." && !is_dir($save_base_dir . $extra_dir)) mkdir($save_base_dir . $extra_dir); - if(is_file($from_file) && (!is_file($save_base_dir . $to_file) || md5_file($from_file) != md5_file($save_base_dir . $to_file))) if(copy($from_file, $save_base_dir . $to_file)) return $save_base_dir . $to_file; @@ -93,7 +92,7 @@ class pts_module } public static function pts_timed_function($time, $function) { - if($time < 15 || $time > 300) + if($time < 5 || $time > 300) return; $pid = pcntl_fork(); |