@@ -84,43 +84,6 @@ static void proc_cpufreq_output(void)
8484}
8585
8686static 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-
12487static void print_duration (unsigned long duration )
12588{
12689 unsigned long tmp ;
@@ -254,11 +217,11 @@ static int get_boost_mode(unsigned int cpu)
254217 if (freqs ) {
255218 printf (_ (" boost frequency steps: " ));
256219 while (freqs -> next ) {
257- print_speed (freqs -> frequency );
220+ print_speed (freqs -> frequency , no_rounding );
258221 printf (", " );
259222 freqs = freqs -> next ;
260223 }
261- print_speed (freqs -> frequency );
224+ print_speed (freqs -> frequency , no_rounding );
262225 printf ("\n" );
263226 cpufreq_put_available_frequencies (freqs );
264227 }
@@ -277,7 +240,7 @@ static int get_freq_kernel(unsigned int cpu, unsigned int human)
277240 return - EINVAL ;
278241 }
279242 if (human ) {
280- print_speed (freq );
243+ print_speed (freq , no_rounding );
281244 } else
282245 printf ("%lu" , freq );
283246 printf (_ (" (asserted by call to kernel)\n" ));
@@ -296,7 +259,7 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
296259 return - EINVAL ;
297260 }
298261 if (human ) {
299- print_speed (freq );
262+ print_speed (freq , no_rounding );
300263 } else
301264 printf ("%lu" , freq );
302265 printf (_ (" (asserted by call to hardware)\n" ));
@@ -316,9 +279,9 @@ static int get_hardware_limits(unsigned int cpu, unsigned int human)
316279
317280 if (human ) {
318281 printf (_ (" hardware limits: " ));
319- print_speed (min );
282+ print_speed (min , no_rounding );
320283 printf (" - " );
321- print_speed (max );
284+ print_speed (max , no_rounding );
322285 printf ("\n" );
323286 } else {
324287 printf ("%lu %lu\n" , min , max );
@@ -350,9 +313,9 @@ static int get_policy(unsigned int cpu)
350313 return - EINVAL ;
351314 }
352315 printf (_ (" current policy: frequency should be within " ));
353- print_speed (policy -> min );
316+ print_speed (policy -> min , no_rounding );
354317 printf (_ (" and " ));
355- print_speed (policy -> max );
318+ print_speed (policy -> max , no_rounding );
356319
357320 printf (".\n " );
358321 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)
436399 struct cpufreq_stats * stats = cpufreq_get_stats (cpu , & total_time );
437400 while (stats ) {
438401 if (human ) {
439- print_speed (stats -> frequency );
402+ print_speed (stats -> frequency , no_rounding );
440403 printf (":%.2f%%" ,
441404 (100.0 * stats -> time_in_state ) / total_time );
442405 } else
@@ -486,11 +449,11 @@ static void debug_output_one(unsigned int cpu)
486449 if (freqs ) {
487450 printf (_ (" available frequency steps: " ));
488451 while (freqs -> next ) {
489- print_speed (freqs -> frequency );
452+ print_speed (freqs -> frequency , no_rounding );
490453 printf (", " );
491454 freqs = freqs -> next ;
492455 }
493- print_speed (freqs -> frequency );
456+ print_speed (freqs -> frequency , no_rounding );
494457 printf ("\n" );
495458 cpufreq_put_available_frequencies (freqs );
496459 }
0 commit comments