Skip to content

Commit

Permalink
fix #12
Browse files Browse the repository at this point in the history
  • Loading branch information
dehydratedpotato authored Oct 8, 2023
1 parent 07d5fb9 commit 1a9b691
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions socpwrbud/socpwrbud.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
{ METRIC_DVFSMS, "show time spent in ms of dvfs states" },
{ METRIC_POWER, "show power consumption of units" },
{ METRIC_VOLTS, "show voltage of units" },
{ METRIC_INSNS, "show instructions retired / per-clock metrics of supporting units" },
{ METRIC_CYCLES, "show the supposed cycles spent during sample of supporting units" },
{ METRIC_INSNS, "show instructions retired / per-clock metrics when available" },
{ METRIC_CYCLES, "show the supposed cycles spent during sample when available" },
{ METRIC_CORES, "show per-core stats for selected metrics on supporting units" }
};

Expand Down Expand Up @@ -477,12 +477,12 @@ static void sample(unit_data* unit_data, cmd_data* cmd_data) {
CFDictionaryRef pwr_delta = IOReportCreateSamplesDelta(pwrsamp_a, pwrsamp_b, NULL);
CFDictionaryRef clpc_delta = IOReportCreateSamplesDelta(clpcsamp_a, clpcsamp_b, NULL);

CFRelease(cpusamp_a);
CFRelease(cpusamp_b);
CFRelease(pwrsamp_a);
CFRelease(pwrsamp_b);
CFRelease(clpcsamp_a);
CFRelease(clpcsamp_b);
if (cpusamp_a != NULL) CFRelease(cpusamp_a);
if (cpusamp_b != NULL) CFRelease(cpusamp_b);
if (pwrsamp_a != NULL) CFRelease(pwrsamp_a);
if (pwrsamp_b != NULL) CFRelease(pwrsamp_b);
if (clpcsamp_a != NULL) CFRelease(clpcsamp_a);
if (clpcsamp_b != NULL) CFRelease(clpcsamp_b);

IOReportIterate(cpu_delta, ^int(IOReportSampleRef sample) {
for (int i = 0; i < IOReportStateGetCount(sample); i++) {
Expand Down Expand Up @@ -637,9 +637,9 @@ static void sample(unit_data* unit_data, cmd_data* cmd_data) {
return kIOReportIterOk;
});

CFRelease(cpu_delta);
CFRelease(pwr_delta);
CFRelease(clpc_delta);
if (cpu_delta != NULL) CFRelease(cpu_delta);
if (pwr_delta != NULL) CFRelease(pwr_delta);
if (clpc_delta != NULL) CFRelease(clpc_delta);
}

static void format(unit_data* unit_data) {
Expand Down Expand Up @@ -746,10 +746,10 @@ static inline void output_text(unit_data* unit_data, cmd_data* cmd_data, int* cu
if ([unit_data->soc_samples.complex_channkeys[i] rangeOfString:@"CPU"].location != NSNotFound) {
fprintf(cmd_data->file_out, "\t%d-Core %s %s:\n\n", [unit_data->percluster_ncores[i] intValue], microarch, [unit_data->soc_samples.complex_channkeys[i] UTF8String]);

if (cmd_data->flags.show_cycles) fprintf(cmd_data->file_out, "\t\tSupposed Cycles Spent: %ld\n", [unit_data->clpc_samples.perf_data.insn_perclk[i] longValue]);
if (cmd_data->flags.show_cycles && unit_data->clpc_samples.clpc_sub != NULL) fprintf(cmd_data->file_out, "\t\tSupposed Cycles Spent: %ld\n", [unit_data->clpc_samples.perf_data.insn_perclk[i] longValue]);

/* instructions metrics are only available on CPU clusters */
if (cmd_data->flags.show_insns) {
if (cmd_data->flags.show_insns && unit_data->clpc_samples.clpc_sub != NULL) {
float retired = [unit_data->clpc_samples.perf_data.insn_retired[i] floatValue];

if (retired > 0) {
Expand Down

0 comments on commit 1a9b691

Please sign in to comment.