@@ -84,43 +84,6 @@ static void proc_cpufreq_output(void)
84
84
}
85
85
86
86
static int no_rounding ;
87
- static void print_speed (unsigned long speed )
88
- {
89
- unsigned long tmp ;
90
-
91
- if (no_rounding ) {
92
- if (speed > 1000000 )
93
- printf ("%u.%06u GHz" , ((unsigned int ) speed /1000000 ),
94
- ((unsigned int ) speed %1000000 ));
95
- else if (speed > 1000 )
96
- printf ("%u.%03u MHz" , ((unsigned int ) speed /1000 ),
97
- (unsigned int ) (speed %1000 ));
98
- else
99
- printf ("%lu kHz" , speed );
100
- } else {
101
- if (speed > 1000000 ) {
102
- tmp = speed %10000 ;
103
- if (tmp >= 5000 )
104
- speed += 10000 ;
105
- printf ("%u.%02u GHz" , ((unsigned int ) speed /1000000 ),
106
- ((unsigned int ) (speed %1000000 )/10000 ));
107
- } else if (speed > 100000 ) {
108
- tmp = speed %1000 ;
109
- if (tmp >= 500 )
110
- speed += 1000 ;
111
- printf ("%u MHz" , ((unsigned int ) speed /1000 ));
112
- } else if (speed > 1000 ) {
113
- tmp = speed %100 ;
114
- if (tmp >= 50 )
115
- speed += 100 ;
116
- printf ("%u.%01u MHz" , ((unsigned int ) speed /1000 ),
117
- ((unsigned int ) (speed %1000 )/100 ));
118
- }
119
- }
120
-
121
- return ;
122
- }
123
-
124
87
static void print_duration (unsigned long duration )
125
88
{
126
89
unsigned long tmp ;
@@ -254,11 +217,11 @@ static int get_boost_mode(unsigned int cpu)
254
217
if (freqs ) {
255
218
printf (_ (" boost frequency steps: " ));
256
219
while (freqs -> next ) {
257
- print_speed (freqs -> frequency );
220
+ print_speed (freqs -> frequency , no_rounding );
258
221
printf (", " );
259
222
freqs = freqs -> next ;
260
223
}
261
- print_speed (freqs -> frequency );
224
+ print_speed (freqs -> frequency , no_rounding );
262
225
printf ("\n" );
263
226
cpufreq_put_available_frequencies (freqs );
264
227
}
@@ -277,7 +240,7 @@ static int get_freq_kernel(unsigned int cpu, unsigned int human)
277
240
return - EINVAL ;
278
241
}
279
242
if (human ) {
280
- print_speed (freq );
243
+ print_speed (freq , no_rounding );
281
244
} else
282
245
printf ("%lu" , freq );
283
246
printf (_ (" (asserted by call to kernel)\n" ));
@@ -296,7 +259,7 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
296
259
return - EINVAL ;
297
260
}
298
261
if (human ) {
299
- print_speed (freq );
262
+ print_speed (freq , no_rounding );
300
263
} else
301
264
printf ("%lu" , freq );
302
265
printf (_ (" (asserted by call to hardware)\n" ));
@@ -316,9 +279,9 @@ static int get_hardware_limits(unsigned int cpu, unsigned int human)
316
279
317
280
if (human ) {
318
281
printf (_ (" hardware limits: " ));
319
- print_speed (min );
282
+ print_speed (min , no_rounding );
320
283
printf (" - " );
321
- print_speed (max );
284
+ print_speed (max , no_rounding );
322
285
printf ("\n" );
323
286
} else {
324
287
printf ("%lu %lu\n" , min , max );
@@ -350,9 +313,9 @@ static int get_policy(unsigned int cpu)
350
313
return - EINVAL ;
351
314
}
352
315
printf (_ (" current policy: frequency should be within " ));
353
- print_speed (policy -> min );
316
+ print_speed (policy -> min , no_rounding );
354
317
printf (_ (" and " ));
355
- print_speed (policy -> max );
318
+ print_speed (policy -> max , no_rounding );
356
319
357
320
printf (".\n " );
358
321
printf (_ ("The governor \"%s\" may decide which speed to use\n"
@@ -436,7 +399,7 @@ static int get_freq_stats(unsigned int cpu, unsigned int human)
436
399
struct cpufreq_stats * stats = cpufreq_get_stats (cpu , & total_time );
437
400
while (stats ) {
438
401
if (human ) {
439
- print_speed (stats -> frequency );
402
+ print_speed (stats -> frequency , no_rounding );
440
403
printf (":%.2f%%" ,
441
404
(100.0 * stats -> time_in_state ) / total_time );
442
405
} else
@@ -486,11 +449,11 @@ static void debug_output_one(unsigned int cpu)
486
449
if (freqs ) {
487
450
printf (_ (" available frequency steps: " ));
488
451
while (freqs -> next ) {
489
- print_speed (freqs -> frequency );
452
+ print_speed (freqs -> frequency , no_rounding );
490
453
printf (", " );
491
454
freqs = freqs -> next ;
492
455
}
493
- print_speed (freqs -> frequency );
456
+ print_speed (freqs -> frequency , no_rounding );
494
457
printf ("\n" );
495
458
cpufreq_put_available_frequencies (freqs );
496
459
}
0 commit comments