Skip to content

Commit

Permalink
0.3.4 tweaks and add M2 Pro/Max codenames
Browse files Browse the repository at this point in the history
  • Loading branch information
dehydratedpotato committed Feb 7, 2023
1 parent d8b8e5e commit 010c9e3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
SocPowerBuddy.xcodeproj/project.xcworkspace/*
SocPowerBuddy.xcodeproj/xcuserdata/*
12 changes: 6 additions & 6 deletions SocPowerBuddy/output.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ void textOutput(iorep_data* iorep,

if (bd->dvfm) {
if ([vd->cluster_freqs[i] floatValue] > 0) {
fprintf(cmd->file_out, "\t\tDvfm Distribution: (");
fprintf(cmd->file_out, "\t\tDvfm Distribution: ");

for (int iii = 0; iii < [sd->dvfm_states[i] count]; iii++) {
float res = [vd->cluster_residencies[i][iii] floatValue];

if (res > 0) {
fprintf(cmd->file_out, "%.f MHz: %.2f%%",[sd->dvfm_states[i][iii] floatValue], res*100);
if (bd->dvfm_ms) fprintf(cmd->file_out, " [%.fms]", res * cmd->interval);
if (bd->dvfm_ms) fprintf(cmd->file_out, " (%.fms)", res * cmd->interval);
fprintf(cmd->file_out, " ");
}
}
fprintf(cmd->file_out, "\b\b\b)\n");
fprintf(cmd->file_out, "\n");
}
}
fprintf(cmd->file_out, "\n");
Expand All @@ -89,18 +89,18 @@ void textOutput(iorep_data* iorep,

if (bd->dvfm) {
if ([vd->core_freqs[i][ii] floatValue] > 0) {
fprintf(cmd->file_out, "\t\t\tDvfm Distribution: (");
fprintf(cmd->file_out, "\t\t\tDvfm Distribution: ");

for (int iii = 0; iii < [sd->dvfm_states[i] count]; iii++) {
float res = [vd->core_residencies[i][ii][iii] floatValue];

if (res > 0) {
fprintf(cmd->file_out, "%.f MHz: %.2f%%",[sd->dvfm_states[i][iii] floatValue], res*100);
if (bd->dvfm_ms) fprintf(cmd->file_out, " [%.fms]", res * cmd->interval);
if (bd->dvfm_ms) fprintf(cmd->file_out, " (%.fms)", res * cmd->interval);
fprintf(cmd->file_out, " ");
}
}
fprintf(cmd->file_out, "\b\b\b)\n");
fprintf(cmd->file_out, "\n");
} else {
fprintf(cmd->file_out, "\t\t\tDvfm Distribution: None\n");
}
Expand Down
2 changes: 1 addition & 1 deletion SocPowerBuddy/socpwrbud.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void format(static_data*, variating_data*);
void generateDvfmTable(static_data*);
void generateCoreCounts(static_data*);
void generateProcessorName(static_data*);
void generateSiliconsIds(static_data*);
void generateSiliconCodename(static_data*);
void generateMicroArchs(static_data*);

#endif /* socpwrbud_h */
2 changes: 1 addition & 1 deletion SocPowerBuddy/socpwrbud.m
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ int main(int argc, char * argv[])

generateDvfmTable(&sd);
generateCoreCounts(&sd);
generateSiliconsIds(&sd);
generateSiliconCodename(&sd);
generateMicroArchs(&sd);

/*
Expand Down
15 changes: 11 additions & 4 deletions SocPowerBuddy/static.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void generateCoreCounts(static_data* sd)
/*
* find silicon id from ioreg
*/
void generateSiliconsIds(static_data * sd)
void generateSiliconCodename(static_data * sd)
{
io_registry_entry_t entry;
io_iterator_t iter;
Expand Down Expand Up @@ -177,7 +177,7 @@ void generateSiliconsIds(static_data * sd)
return;

error:
/* find the silicon id using stored strings if can't access ioreg */
/* find the silicon codename using stored strings if can't access ioreg */
if ([sd->extra[0] rangeOfString:@"M1"].location != NSNotFound) {
if ([sd->extra[0] rangeOfString:@"M1 Pro"].location != NSNotFound)
[sd->extra addObject:@"T6000"];
Expand All @@ -187,8 +187,15 @@ void generateSiliconsIds(static_data * sd)
[sd->extra addObject:@"T6002"];
else
[sd->extra addObject:@"T8103"];
} else if ([sd->extra[0] isEqual:@"Apple M2"])
[sd->extra addObject:@"T8112"];
} else if ([sd->extra[0] rangeOfString:@"M2"].location != NSNotFound)
if ([sd->extra[0] rangeOfString:@"M2 Pro"].location != NSNotFound)
[sd->extra addObject:@"T6020"];
else if ([sd->extra[0] rangeOfString:@"M2 Max"].location != NSNotFound)
[sd->extra addObject:@"T6021"];
else if ([sd->extra[0] rangeOfString:@"M2 Ultra"].location != NSNotFound)
[sd->extra addObject:@"T6022"];
else
[sd->extra addObject:@"T8112"];
else
[sd->extra addObject:@"T****"];
}
Expand Down

0 comments on commit 010c9e3

Please sign in to comment.