add full debug to intel device
This commit is contained in:
parent
30d99079a7
commit
bfce5e7f0c
@ -20,6 +20,23 @@ our @EXPORT_OK = qw(
|
|||||||
sub get_intel_gpu_devices {
|
sub get_intel_gpu_devices {
|
||||||
my @devices = ();
|
my @devices = ();
|
||||||
|
|
||||||
|
if ($config{debug}{intel_mode} && -f $config{debug}{intel_devices_file}) {
|
||||||
|
debug(__LINE__, "Debug mode: reading Intel GPU devices from $config{debug}{intel_devices_file}");
|
||||||
|
my $data = safe_read_json($config{debug}{intel_devices_file});
|
||||||
|
if ($data && ref $data eq 'ARRAY') {
|
||||||
|
for my $dev (@$data) {
|
||||||
|
push @devices, {
|
||||||
|
card => $dev->{card},
|
||||||
|
name => $dev->{name},
|
||||||
|
path => $dev->{path},
|
||||||
|
drm_path => $dev->{drm_path},
|
||||||
|
};
|
||||||
|
debug(__LINE__, "Found Intel device (debug): $dev->{card} -> $dev->{name} ($dev->{path})");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
debug(__LINE__, "Failed to parse debug file $config{debug}{intel_devices_file}");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
debug(__LINE__, "Getting Intel GPU devices");
|
debug(__LINE__, "Getting Intel GPU devices");
|
||||||
if (open my $fh, '-|', 'intel_gpu_top -L') {
|
if (open my $fh, '-|', 'intel_gpu_top -L') {
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
@ -41,6 +58,7 @@ sub get_intel_gpu_devices {
|
|||||||
} else {
|
} else {
|
||||||
debug(__LINE__, "Failed to run intel_gpu_top -L: $!");
|
debug(__LINE__, "Failed to run intel_gpu_top -L: $!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return @devices;
|
return @devices;
|
||||||
}
|
}
|
||||||
@ -132,6 +150,41 @@ sub collector_for_intel_device {
|
|||||||
if defined $intel_gpu_top_pid && $intel_gpu_top_pid > 0;
|
if defined $intel_gpu_top_pid && $intel_gpu_top_pid > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
my $node_name = "node0";
|
||||||
|
|
||||||
|
if ($config{debug}{intel_mode} && -f $config{debug}{intel_output_file}) {
|
||||||
|
debug(__LINE__, "Debug mode: reading Intel GPU stats from $config{debug}{intel_output_file}");
|
||||||
|
while (!$shutdown) {
|
||||||
|
if (open my $fh, '<', $config{debug}{intel_output_file}) {
|
||||||
|
while (my $line = <$fh>) {
|
||||||
|
chomp $line;
|
||||||
|
next if $line =~ /MHz|IRQ|RC6|Power|RCS|BCS|VCS|VECS|req\s+act|^\s*$/;
|
||||||
|
|
||||||
|
if ($line =~ /^\s*[\d\s\.]+$/) {
|
||||||
|
my $stats = _parse_intel_gpu_line($line);
|
||||||
|
|
||||||
|
if ($stats) {
|
||||||
|
my $device_data = {
|
||||||
|
$node_name => {
|
||||||
|
name => $device->{name},
|
||||||
|
device_path => $device->{path},
|
||||||
|
drm_path => $device->{drm_path},
|
||||||
|
stats => $stats,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
safe_write_json($device_state_file, $device_data);
|
||||||
|
update_intel_gpu_rrd($device->{card}, $stats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close $fh;
|
||||||
|
} else {
|
||||||
|
debug(__LINE__, "Failed to open debug file $config{debug}{intel_output_file}: $!");
|
||||||
|
}
|
||||||
|
sleep $config{intervals}{data_pull} unless $shutdown;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
debug(__LINE__, "About to open pipe to intel_gpu_top");
|
debug(__LINE__, "About to open pipe to intel_gpu_top");
|
||||||
my $intel_pull_interval = $config{intervals}{data_pull} * 1000; # milliseconds
|
my $intel_pull_interval = $config{intervals}{data_pull} * 1000; # milliseconds
|
||||||
$intel_gpu_top_pid = open(my $fh, '-|',
|
$intel_gpu_top_pid = open(my $fh, '-|',
|
||||||
@ -144,8 +197,6 @@ sub collector_for_intel_device {
|
|||||||
|
|
||||||
debug(__LINE__, "Pipe opened successfully, PID=$intel_gpu_top_pid");
|
debug(__LINE__, "Pipe opened successfully, PID=$intel_gpu_top_pid");
|
||||||
|
|
||||||
my $node_name = "node0";
|
|
||||||
|
|
||||||
while (my $line = <$fh>) {
|
while (my $line = <$fh>) {
|
||||||
last if $shutdown;
|
last if $shutdown;
|
||||||
chomp $line;
|
chomp $line;
|
||||||
@ -172,6 +223,8 @@ sub collector_for_intel_device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close $fh;
|
close $fh;
|
||||||
|
}
|
||||||
|
|
||||||
debug(__LINE__, "Collector for $device->{card} shutting down");
|
debug(__LINE__, "Collector for $device->{card} shutting down");
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,6 +42,7 @@ our %config = (
|
|||||||
lm_sensors_output_file => '/tmp/sensors-output.json',
|
lm_sensors_output_file => '/tmp/sensors-output.json',
|
||||||
intel_mode => 0,
|
intel_mode => 0,
|
||||||
intel_devices_file => '/tmp/intel-gpu-devices.json',
|
intel_devices_file => '/tmp/intel-gpu-devices.json',
|
||||||
|
intel_output_file => '/tmp/intel-gpu-output.json',
|
||||||
nvidia_mode => 0,
|
nvidia_mode => 0,
|
||||||
nvidia_devices_file => '/tmp/nvidia-smi-devices.csv',
|
nvidia_devices_file => '/tmp/nvidia-smi-devices.csv',
|
||||||
nvidia_output_file => '/tmp/nvidia-smi-output.csv',
|
nvidia_output_file => '/tmp/nvidia-smi-output.csv',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user