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;
         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 (in_array('i915_energy', $to_show) && is_readable('/sys/kernel/debug/dri/0/i915_energy')) {
         // For now the Intel monitoring is a special case separate from the rest
         // of the unified sensor monitoring since we're not polling it every time but just pre/post test.
         self::$monitor_i915_energy = true;
     }
     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);
 }
 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::$per_test_try_monitoring = pts_module::read_variable('MONITOR_PER_RUN') === '1';
     self::$to_monitor = array();
     try {
         self::check_if_results_saved($test_run_manager);
         $sensor_parameters = self::prepare_sensor_parameters();
         self::enable_perf_per_watt($sensor_parameters);
         self::process_sensor_list($sensor_parameters);
         self::create_monitoring_cgroups();
         self::print_monitored_sensors();
         self::set_monitoring_interval();
         // Pad some idling sensor results at the start
         sleep(self::$sensor_monitoring_frequency * 8);
         self::pts_start_monitoring();
     } catch (Exception $e) {
         echo PHP_EOL . "Unloading system monitor: " . $e->getMessage();
         return pts_module::MODULE_UNLOAD;
     }
 }