public static function __pre_run_process()
 {
     self::$screenshots = array();
     pts_module::pts_timed_function('take_screenshot', self::$screenshot_interval);
 }
 private static function pts_start_monitoring()
 {
     $instant_sensors = array();
     foreach (self::$to_monitor as $sensor) {
         $is_instant = $sensor->is_instant();
         if ($is_instant === false) {
             $pid = pts_module::pts_timed_function('pts_monitor_update', self::$sensor_monitoring_frequency, array(array($sensor)));
         } else {
             $instant_sensors[] = $sensor;
         }
     }
     if (!empty($instant_sensors)) {
         pts_module::pts_timed_function('pts_monitor_update', self::$sensor_monitoring_frequency, array($instant_sensors));
     }
 }
 public static function __pre_run_process(&$test_run_manager)
 {
     self::$result_identifier = $test_run_manager->get_results_identifier();
     self::$individual_monitoring = pts_module::read_variable('MONITOR_INDIVIDUAL') !== '0';
     self::$to_monitor = array();
     $to_show = pts_strings::comma_explode(pts_module::read_variable('MONITOR'));
     if (pts_module::read_variable('PERFORMANCE_PER_WATT')) {
         // We need to ensure the system power consumption is being tracked to get performance-per-Watt
         pts_arrays::unique_push($to_show, 'sys.power');
         self::$individual_monitoring = true;
         self::$perf_per_watt_collection = array();
         echo PHP_EOL . 'To Provide Performance-Per-Watt Outputs.' . PHP_EOL;
     }
     $monitor_all = in_array('all', $to_show);
     foreach (phodevi::supported_sensors() as $sensor) {
         if ($monitor_all || in_array(phodevi::sensor_identifier($sensor), $to_show) || in_array('all.' . $sensor[0], $to_show)) {
             array_push(self::$to_monitor, $sensor);
             pts_module::save_file('logs/' . phodevi::sensor_identifier($sensor));
         }
     }
     if (count(self::$to_monitor) > 0) {
         echo PHP_EOL . 'Sensors To Be Logged:';
         foreach (self::$to_monitor as &$sensor) {
             echo PHP_EOL . '   - ' . phodevi::sensor_name($sensor);
         }
         echo PHP_EOL;
         if (pts_module::read_variable('MONITOR_INTERVAL') != null) {
             $proposed_interval = pts_module::read_variable('MONITOR_INTERVAL');
             if (is_numeric($proposed_interval) && $proposed_interval >= 1) {
                 self::$sensor_monitoring_frequency = $proposed_interval;
             }
         }
         // Pad some idling sensor results at the start
         sleep(self::$sensor_monitoring_frequency * 8);
     }
     pts_module::pts_timed_function('pts_monitor_update', self::$sensor_monitoring_frequency);
 }