1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/*
* Copyright 2010, Intel Corporation
*
* This file is part of PowerTOP
*
* This program file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program in a file named COPYING; if not, write to the
* Free Software Foundation, Inc,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* or just google for it.
*
* Authors:
* Arjan van de Ven <arjan@linux.intel.com>
*/
#include <stdio.h>
#include "cpu.h"
#include "../lib.h"
#include "../parameters/parameters.h"
void cpu_package::freq_updated(uint64_t time)
{
if (parent)
parent->calculate_freq(time);
/*
* Make the frequency changes to propagate to all cores in a package.
*/
change_effective_frequency(time, current_frequency);
old_idle = idle;
}
char * cpu_package::fill_cstate_line(int line_nr, char *buffer, const char *separator)
{
unsigned int i;
buffer[0] = 0;
if (line_nr == LEVEL_HEADER) {
sprintf(buffer, this->has_intel_MSR ? _(" Pkg(HW)"): _(" Pkg(OS)"));
}
for (i = 0; i < cstates.size(); i++) {
if (cstates[i]->line_level != line_nr)
continue;
sprintf(buffer,"%5.1f%%", percentage(cstates[i]->duration_delta / time_factor));
}
return buffer;
}
char * cpu_package::fill_cstate_name(int line_nr, char *buffer)
{
unsigned int i;
buffer[0] = 0;
for (i = 0; i < cstates.size(); i++) {
if (cstates[i]->line_level != line_nr)
continue;
sprintf(buffer,"%s", cstates[i]->human_name);
}
return buffer;
}
char * cpu_package::fill_pstate_name(int line_nr, char *buffer)
{
buffer[0] = 0;
if (line_nr >= (int)pstates.size() || line_nr < 0)
return buffer;
sprintf(buffer,"%s", pstates[line_nr]->human_name);
return buffer;
}
char * cpu_package::fill_pstate_line(int line_nr, char *buffer)
{
buffer[0] = 0;
unsigned int i;
if (total_stamp ==0) {
for (i = 0; i < pstates.size(); i++)
total_stamp += pstates[i]->time_after;
if (total_stamp == 0)
total_stamp = 1;
}
if (line_nr == LEVEL_HEADER) {
sprintf(buffer,_(" Package"));
return buffer;
}
if (line_nr >= (int)pstates.size() || line_nr < 0)
return buffer;
sprintf(buffer," %5.1f%% ", percentage(1.0* (pstates[line_nr]->time_after) / total_stamp));
return buffer;
}
|