1
0
Fork 0

linux-cpupower-4.18-rc1

This cpupower update for 4.18-rc1 consists of two minor fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJbFbJsAAoJEAsCRMQNDUMczvAQANheU35A5iJRreVQjtB6lDD1
 9gSE+yARAd/NXr1wmbEf+/0+WoIbhVekZahgvBjoQIP2vkrjCXWhaOhrPEJ90KJW
 Nza6qcaRndWwE4+0sg+kf9JwP7o23mT6vcf4/Kn4eQXuuDUbqQ+oao1iUgmEi0q6
 V2cDUMmKbzDywH8sBADYELF0kYWKiFysSj1xpoo1J0axPzblr72b3ru2tFSDV5j2
 OkTsToGUESma27fOY4ZB7DTgF9DgB56Y4vZhrD9hmz8FS+tVn9gsGTZh0GTVwlUT
 +p36GeHDLcwUeG66bqdBLTNsx/dKRbfqFeDSgv8EEyyMpSeTNVcANSfEF2NsNiNo
 /nhvOvGzFZFOMZAqcyB65/jLsZC7HDIXdDXB/FNfHLaxKR0tw45MzOavNaLwrTWg
 mnncsuNLDE6kwsyaoP1MeItN1e8aAtuwTxYL9HCBzX9vjcOD8cozuI3KlR1thOqc
 JbKFiViZSRmi/GVt2Aeu/AWsVeI2aDn0BphSo4dWcLtlM88hKzywzxpOkwhz23w7
 bwvX4jEi4pDKu5XlWAj2c7+cjizEx3paESc76TKfV1dDr/BTgTEN01prIvwP/yv2
 gEmrRG+i0HERN5hPHJ8kIG3m6HoMa75kEw9AuK0Bxb286m3JOqr8DiVoEbmrBnal
 /CtzBYVvXLBDslI1+0gZ
 =BSJW
 -----END PGP SIGNATURE-----

Merge tag 'linux-cpupower-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux

Pull cpupower updates for v4.18-rc1 from Shuah Khan:

"This cpupower update for 4.18-rc1 consists of two minor fixes."

* tag 'linux-cpupower-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux:
  cpupower : Fix header name to read idle state name
  cpupower: fix spelling mistake: "logilename" -> "logfilename"
hifive-unleashed-5.1
Rafael J. Wysocki 2018-06-06 08:41:01 +02:00
commit 5202e32db0
4 changed files with 45 additions and 16 deletions

View File

@ -104,7 +104,7 @@ FILE *prepare_output(const char *dirname)
dirname, time(NULL));
}
dprintf("logilename: %s\n", filename);
dprintf("logfilename: %s\n", filename);
output = fopen(filename, "w+");
if (output == NULL) {

View File

@ -126,6 +126,20 @@ void fix_up_intel_idle_driver_name(char *tmp, int num)
}
}
#ifdef __powerpc__
void map_power_idle_state_name(char *tmp)
{
if (!strncmp(tmp, "stop0_lite", CSTATE_NAME_LEN))
strcpy(tmp, "stop0L");
else if (!strncmp(tmp, "stop1_lite", CSTATE_NAME_LEN))
strcpy(tmp, "stop1L");
else if (!strncmp(tmp, "stop2_lite", CSTATE_NAME_LEN))
strcpy(tmp, "stop2L");
}
#else
void map_power_idle_state_name(char *tmp) { }
#endif
static struct cpuidle_monitor *cpuidle_register(void)
{
int num;
@ -145,6 +159,7 @@ static struct cpuidle_monitor *cpuidle_register(void)
if (tmp == NULL)
continue;
map_power_idle_state_name(tmp);
fix_up_intel_idle_driver_name(tmp, num);
strncpy(cpuidle_cstates[num].name, tmp, CSTATE_NAME_LEN - 1);
free(tmp);

View File

@ -70,36 +70,43 @@ void print_n_spaces(int n)
printf(" ");
}
/* size of s must be at least n + 1 */
/*s is filled with left and right spaces
*to make its length atleast n+1
*/
int fill_string_with_spaces(char *s, int n)
{
char *temp;
int len = strlen(s);
if (len > n)
if (len >= n)
return -1;
temp = malloc(sizeof(char) * (n+1));
for (; len < n; len++)
s[len] = ' ';
s[len] = '\0';
snprintf(temp, n+1, " %s", s);
strcpy(s, temp);
free(temp);
return 0;
}
#define MAX_COL_WIDTH 6
void print_header(int topology_depth)
{
int unsigned mon;
int state, need_len;
cstate_t s;
char buf[128] = "";
int percent_width = 4;
fill_string_with_spaces(buf, topology_depth * 5 - 1);
printf("%s|", buf);
for (mon = 0; mon < avail_monitors; mon++) {
need_len = monitors[mon]->hw_states_num * (percent_width + 3)
need_len = monitors[mon]->hw_states_num * (MAX_COL_WIDTH + 1)
- 1;
if (mon != 0) {
printf("|| ");
need_len--;
}
if (mon != 0)
printf("||");
sprintf(buf, "%s", monitors[mon]->name);
fill_string_with_spaces(buf, need_len);
printf("%s", buf);
@ -107,23 +114,21 @@ void print_header(int topology_depth)
printf("\n");
if (topology_depth > 2)
printf("PKG |");
printf(" PKG|");
if (topology_depth > 1)
printf("CORE|");
if (topology_depth > 0)
printf("CPU |");
printf(" CPU|");
for (mon = 0; mon < avail_monitors; mon++) {
if (mon != 0)
printf("|| ");
else
printf(" ");
printf("||");
for (state = 0; state < monitors[mon]->hw_states_num; state++) {
if (state != 0)
printf(" | ");
printf("|");
s = monitors[mon]->hw_states[state];
sprintf(buf, "%s", s.name);
fill_string_with_spaces(buf, percent_width);
fill_string_with_spaces(buf, MAX_COL_WIDTH);
printf("%s", buf);
}
printf(" ");

View File

@ -15,7 +15,16 @@
#define MONITORS_MAX 20
#define MONITOR_NAME_LEN 20
/* CSTATE_NAME_LEN is limited by header field width defined
* in cpupower-monitor.c. Header field width is defined to be
* sum of percent width and two spaces for padding.
*/
#ifdef __powerpc__
#define CSTATE_NAME_LEN 7
#else
#define CSTATE_NAME_LEN 5
#endif
#define CSTATE_DESC_LEN 60
int cpu_count;