turbostat.c (04421fe2671c1790ab6529fad87ce8c73af0e1eb) turbostat.c (fc04cc67ea8f44124f048832a745a24bc2fa12fa)
1/*
2 * turbostat -- show CPU frequency and C-state residency
3 * on modern Intel turbo-capable processors.
4 *
5 * Copyright (c) 2013 Intel Corporation.
6 * Len Brown <len.brown@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it

--- 42 unchanged lines hidden (view full) ---

51unsigned int skip_c1;
52unsigned int do_nhm_cstates;
53unsigned int do_snb_cstates;
54unsigned int do_c8_c9_c10;
55unsigned int do_slm_cstates;
56unsigned int use_c1_residency_msr;
57unsigned int has_aperf;
58unsigned int has_epb;
1/*
2 * turbostat -- show CPU frequency and C-state residency
3 * on modern Intel turbo-capable processors.
4 *
5 * Copyright (c) 2013 Intel Corporation.
6 * Len Brown <len.brown@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it

--- 42 unchanged lines hidden (view full) ---

51unsigned int skip_c1;
52unsigned int do_nhm_cstates;
53unsigned int do_snb_cstates;
54unsigned int do_c8_c9_c10;
55unsigned int do_slm_cstates;
56unsigned int use_c1_residency_msr;
57unsigned int has_aperf;
58unsigned int has_epb;
59unsigned int units = 1000000000; /* Ghz etc */
59unsigned int units = 1000000; /* MHz etc */
60unsigned int genuine_intel;
61unsigned int has_invariant_tsc;
62unsigned int do_nehalem_platform_info;
63unsigned int do_nehalem_turbo_ratio_limit;
64unsigned int do_ivt_turbo_ratio_limit;
65unsigned int extra_msr_offset32;
66unsigned int extra_msr_offset64;
67unsigned int extra_delta_offset32;

--- 191 unchanged lines hidden (view full) ---

259 if (retval != sizeof *msr) {
260 fprintf(stderr, "%s offset 0x%llx read failed\n", pathname, (unsigned long long)offset);
261 return -1;
262 }
263
264 return 0;
265}
266
60unsigned int genuine_intel;
61unsigned int has_invariant_tsc;
62unsigned int do_nehalem_platform_info;
63unsigned int do_nehalem_turbo_ratio_limit;
64unsigned int do_ivt_turbo_ratio_limit;
65unsigned int extra_msr_offset32;
66unsigned int extra_msr_offset64;
67unsigned int extra_delta_offset32;

--- 191 unchanged lines hidden (view full) ---

259 if (retval != sizeof *msr) {
260 fprintf(stderr, "%s offset 0x%llx read failed\n", pathname, (unsigned long long)offset);
261 return -1;
262 }
263
264 return 0;
265}
266
267/*
268 * Example Format w/ field column widths:
269 *
270 * Package Core CPU Avg_MHz Bzy_MHz TSC_MHz SMI %Busy CPU_%c1 CPU_%c3 CPU_%c6 CPU_%c7 CoreTmp PkgTmp Pkg%pc2 Pkg%pc3 Pkg%pc6 Pkg%pc7 PkgWatt CorWatt GFXWatt
271 * 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567
272 */
273
267void print_header(void)
268{
269 if (show_pkg)
274void print_header(void)
275{
276 if (show_pkg)
270 outp += sprintf(outp, "pk");
271 if (show_pkg)
272 outp += sprintf(outp, " ");
277 outp += sprintf(outp, "Package ");
273 if (show_core)
278 if (show_core)
274 outp += sprintf(outp, "cor");
279 outp += sprintf(outp, " Core ");
275 if (show_cpu)
280 if (show_cpu)
276 outp += sprintf(outp, " CPU");
277 if (show_pkg || show_core || show_cpu)
278 outp += sprintf(outp, " ");
281 outp += sprintf(outp, " CPU ");
282 if (has_aperf)
283 outp += sprintf(outp, "Avg_MHz ");
279 if (do_nhm_cstates)
284 if (do_nhm_cstates)
280 outp += sprintf(outp, " %%c0");
285 outp += sprintf(outp, " %%Busy ");
281 if (has_aperf)
286 if (has_aperf)
282 outp += sprintf(outp, " GHz");
283 outp += sprintf(outp, " TSC");
287 outp += sprintf(outp, "Bzy_MHz ");
288 outp += sprintf(outp, "TSC_MHz ");
284 if (do_smi)
289 if (do_smi)
285 outp += sprintf(outp, " SMI");
290 outp += sprintf(outp, " SMI ");
286 if (extra_delta_offset32)
291 if (extra_delta_offset32)
287 outp += sprintf(outp, " count 0x%03X", extra_delta_offset32);
292 outp += sprintf(outp, " count 0x%03X ", extra_delta_offset32);
288 if (extra_delta_offset64)
293 if (extra_delta_offset64)
289 outp += sprintf(outp, " COUNT 0x%03X", extra_delta_offset64);
294 outp += sprintf(outp, " COUNT 0x%03X ", extra_delta_offset64);
290 if (extra_msr_offset32)
295 if (extra_msr_offset32)
291 outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset32);
296 outp += sprintf(outp, " MSR 0x%03X ", extra_msr_offset32);
292 if (extra_msr_offset64)
297 if (extra_msr_offset64)
293 outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset64);
298 outp += sprintf(outp, " MSR 0x%03X ", extra_msr_offset64);
294 if (do_nhm_cstates)
299 if (do_nhm_cstates)
295 outp += sprintf(outp, " %%c1");
300 outp += sprintf(outp, " CPU%%c1 ");
296 if (do_nhm_cstates && !do_slm_cstates)
301 if (do_nhm_cstates && !do_slm_cstates)
297 outp += sprintf(outp, " %%c3");
302 outp += sprintf(outp, " CPU%%c3 ");
298 if (do_nhm_cstates)
303 if (do_nhm_cstates)
299 outp += sprintf(outp, " %%c6");
304 outp += sprintf(outp, " CPU%%c6 ");
300 if (do_snb_cstates)
305 if (do_snb_cstates)
301 outp += sprintf(outp, " %%c7");
306 outp += sprintf(outp, " CPU%%c7 ");
302
303 if (do_dts)
307
308 if (do_dts)
304 outp += sprintf(outp, " CTMP");
309 outp += sprintf(outp, "CoreTmp ");
305 if (do_ptm)
310 if (do_ptm)
306 outp += sprintf(outp, " PTMP");
311 outp += sprintf(outp, " PkgTmp ");
307
308 if (do_snb_cstates)
312
313 if (do_snb_cstates)
309 outp += sprintf(outp, " %%pc2");
314 outp += sprintf(outp, "Pkg%%pc2 ");
310 if (do_nhm_cstates && !do_slm_cstates)
315 if (do_nhm_cstates && !do_slm_cstates)
311 outp += sprintf(outp, " %%pc3");
316 outp += sprintf(outp, "Pkg%%pc3 ");
312 if (do_nhm_cstates && !do_slm_cstates)
317 if (do_nhm_cstates && !do_slm_cstates)
313 outp += sprintf(outp, " %%pc6");
318 outp += sprintf(outp, "Pkg%%pc6 ");
314 if (do_snb_cstates)
319 if (do_snb_cstates)
315 outp += sprintf(outp, " %%pc7");
320 outp += sprintf(outp, "Pkg%%pc7 ");
316 if (do_c8_c9_c10) {
321 if (do_c8_c9_c10) {
317 outp += sprintf(outp, " %%pc8");
318 outp += sprintf(outp, " %%pc9");
319 outp += sprintf(outp, " %%pc10");
322 outp += sprintf(outp, "Pkg%%pc8 ");
323 outp += sprintf(outp, "Pkg%%pc9 ");
324 outp += sprintf(outp, "Pk%%pc10 ");
320 }
321
322 if (do_rapl && !rapl_joules) {
323 if (do_rapl & RAPL_PKG)
325 }
326
327 if (do_rapl && !rapl_joules) {
328 if (do_rapl & RAPL_PKG)
324 outp += sprintf(outp, " Pkg_W");
329 outp += sprintf(outp, "PkgWatt ");
325 if (do_rapl & RAPL_CORES)
330 if (do_rapl & RAPL_CORES)
326 outp += sprintf(outp, " Cor_W");
331 outp += sprintf(outp, "CorWatt ");
327 if (do_rapl & RAPL_GFX)
332 if (do_rapl & RAPL_GFX)
328 outp += sprintf(outp, " GFX_W");
333 outp += sprintf(outp, "GFXWatt ");
329 if (do_rapl & RAPL_DRAM)
334 if (do_rapl & RAPL_DRAM)
330 outp += sprintf(outp, " RAM_W");
335 outp += sprintf(outp, "RAMWatt ");
331 if (do_rapl & RAPL_PKG_PERF_STATUS)
336 if (do_rapl & RAPL_PKG_PERF_STATUS)
332 outp += sprintf(outp, " PKG_%%");
337 outp += sprintf(outp, " PKG_%% ");
333 if (do_rapl & RAPL_DRAM_PERF_STATUS)
338 if (do_rapl & RAPL_DRAM_PERF_STATUS)
334 outp += sprintf(outp, " RAM_%%");
339 outp += sprintf(outp, " RAM_%% ");
335 } else {
336 if (do_rapl & RAPL_PKG)
340 } else {
341 if (do_rapl & RAPL_PKG)
337 outp += sprintf(outp, " Pkg_J");
342 outp += sprintf(outp, " Pkg_J ");
338 if (do_rapl & RAPL_CORES)
343 if (do_rapl & RAPL_CORES)
339 outp += sprintf(outp, " Cor_J");
344 outp += sprintf(outp, " Cor_J ");
340 if (do_rapl & RAPL_GFX)
345 if (do_rapl & RAPL_GFX)
341 outp += sprintf(outp, " GFX_J");
346 outp += sprintf(outp, " GFX_J ");
342 if (do_rapl & RAPL_DRAM)
347 if (do_rapl & RAPL_DRAM)
343 outp += sprintf(outp, " RAM_W");
348 outp += sprintf(outp, " RAM_W ");
344 if (do_rapl & RAPL_PKG_PERF_STATUS)
349 if (do_rapl & RAPL_PKG_PERF_STATUS)
345 outp += sprintf(outp, " PKG_%%");
350 outp += sprintf(outp, " PKG_%% ");
346 if (do_rapl & RAPL_DRAM_PERF_STATUS)
351 if (do_rapl & RAPL_DRAM_PERF_STATUS)
347 outp += sprintf(outp, " RAM_%%");
348 outp += sprintf(outp, " time");
352 outp += sprintf(outp, " RAM_%% ");
353 outp += sprintf(outp, " time ");
349
350 }
351 outp += sprintf(outp, "\n");
352}
353
354int dump_counters(struct thread_data *t, struct core_data *c,
355 struct pkg_data *p)
356{

--- 48 unchanged lines hidden (view full) ---

405
406 outp += sprintf(outp, "\n");
407
408 return 0;
409}
410
411/*
412 * column formatting convention & formats
354
355 }
356 outp += sprintf(outp, "\n");
357}
358
359int dump_counters(struct thread_data *t, struct core_data *c,
360 struct pkg_data *p)
361{

--- 48 unchanged lines hidden (view full) ---

410
411 outp += sprintf(outp, "\n");
412
413 return 0;
414}
415
416/*
417 * column formatting convention & formats
413 * package: "pk" 2 columns %2d
414 * core: "cor" 3 columns %3d
415 * CPU: "CPU" 3 columns %3d
416 * Pkg_W: %6.2
417 * Cor_W: %6.2
418 * GFX_W: %5.2
419 * RAM_W: %5.2
420 * GHz: "GHz" 3 columns %3.2
421 * TSC: "TSC" 3 columns %3.2
422 * SMI: "SMI" 4 columns %4d
423 * percentage " %pc3" %6.2
424 * Perf Status percentage: %5.2
425 * "CTMP" 4 columns %4d
426 */
427int format_counters(struct thread_data *t, struct core_data *c,
428 struct pkg_data *p)
429{
430 double interval_float;
418 */
419int format_counters(struct thread_data *t, struct core_data *c,
420 struct pkg_data *p)
421{
422 double interval_float;
431 char *fmt5, *fmt6;
423 char *fmt8;
432
433 /* if showing only 1st thread in core and this isn't one, bail out */
434 if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
435 return 0;
436
437 /* if showing only 1st thread in pkg and this isn't one, bail out */
438 if (show_pkg_only && !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
439 return 0;
440
441 interval_float = tv_delta.tv_sec + tv_delta.tv_usec/1000000.0;
442
443 /* topo columns, print blanks on 1st (average) line */
444 if (t == &average.threads) {
445 if (show_pkg)
424
425 /* if showing only 1st thread in core and this isn't one, bail out */
426 if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
427 return 0;
428
429 /* if showing only 1st thread in pkg and this isn't one, bail out */
430 if (show_pkg_only && !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
431 return 0;
432
433 interval_float = tv_delta.tv_sec + tv_delta.tv_usec/1000000.0;
434
435 /* topo columns, print blanks on 1st (average) line */
436 if (t == &average.threads) {
437 if (show_pkg)
446 outp += sprintf(outp, " ");
447 if (show_pkg && show_core)
448 outp += sprintf(outp, " ");
438 outp += sprintf(outp, " -");
449 if (show_core)
439 if (show_core)
450 outp += sprintf(outp, " ");
440 outp += sprintf(outp, " -");
451 if (show_cpu)
441 if (show_cpu)
452 outp += sprintf(outp, " " " ");
442 outp += sprintf(outp, " -");
453 } else {
454 if (show_pkg) {
455 if (p)
443 } else {
444 if (show_pkg) {
445 if (p)
456 outp += sprintf(outp, "%2d", p->package_id);
446 outp += sprintf(outp, "%8d", p->package_id);
457 else
447 else
458 outp += sprintf(outp, " ");
448 outp += sprintf(outp, " -");
459 }
449 }
460 if (show_pkg && show_core)
461 outp += sprintf(outp, " ");
462 if (show_core) {
463 if (c)
450 if (show_core) {
451 if (c)
464 outp += sprintf(outp, "%3d", c->core_id);
452 outp += sprintf(outp, "%8d", c->core_id);
465 else
453 else
466 outp += sprintf(outp, " ");
454 outp += sprintf(outp, " -");
467 }
468 if (show_cpu)
455 }
456 if (show_cpu)
469 outp += sprintf(outp, " %3d", t->cpu_id);
457 outp += sprintf(outp, "%8d", t->cpu_id);
470 }
458 }
459
460 /* AvgMHz */
461 if (has_aperf)
462 outp += sprintf(outp, "%8.0f",
463 1.0 / units * t->aperf / interval_float);
464
471 /* %c0 */
472 if (do_nhm_cstates) {
465 /* %c0 */
466 if (do_nhm_cstates) {
473 if (show_pkg || show_core || show_cpu)
474 outp += sprintf(outp, " ");
475 if (!skip_c0)
467 if (!skip_c0)
476 outp += sprintf(outp, "%6.2f", 100.0 * t->mperf/t->tsc);
468 outp += sprintf(outp, "%8.2f", 100.0 * t->mperf/t->tsc);
477 else
469 else
478 outp += sprintf(outp, " ****");
470 outp += sprintf(outp, "********");
479 }
480
471 }
472
481 /* GHz */
482 if (has_aperf) {
483 if (!aperf_mperf_unstable) {
484 outp += sprintf(outp, " %3.2f",
485 1.0 * t->tsc / units * t->aperf /
486 t->mperf / interval_float);
487 } else {
488 if (t->aperf > t->tsc || t->mperf > t->tsc) {
489 outp += sprintf(outp, " ***");
490 } else {
491 outp += sprintf(outp, "%3.1f*",
492 1.0 * t->tsc /
493 units * t->aperf /
494 t->mperf / interval_float);
495 }
496 }
497 }
473 /* BzyMHz */
474 if (has_aperf)
475 outp += sprintf(outp, "%8.0f",
476 1.0 * t->tsc / units * t->aperf / t->mperf / interval_float);
498
499 /* TSC */
477
478 /* TSC */
500 outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float);
479 outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float);
501
502 /* SMI */
503 if (do_smi)
480
481 /* SMI */
482 if (do_smi)
504 outp += sprintf(outp, "%4d", t->smi_count);
483 outp += sprintf(outp, "%8d", t->smi_count);
505
506 /* delta */
507 if (extra_delta_offset32)
508 outp += sprintf(outp, " %11llu", t->extra_delta32);
509
510 /* DELTA */
511 if (extra_delta_offset64)
512 outp += sprintf(outp, " %11llu", t->extra_delta64);
513 /* msr */
514 if (extra_msr_offset32)
515 outp += sprintf(outp, " 0x%08llx", t->extra_msr32);
516
517 /* MSR */
518 if (extra_msr_offset64)
519 outp += sprintf(outp, " 0x%016llx", t->extra_msr64);
520
521 if (do_nhm_cstates) {
522 if (!skip_c1)
484
485 /* delta */
486 if (extra_delta_offset32)
487 outp += sprintf(outp, " %11llu", t->extra_delta32);
488
489 /* DELTA */
490 if (extra_delta_offset64)
491 outp += sprintf(outp, " %11llu", t->extra_delta64);
492 /* msr */
493 if (extra_msr_offset32)
494 outp += sprintf(outp, " 0x%08llx", t->extra_msr32);
495
496 /* MSR */
497 if (extra_msr_offset64)
498 outp += sprintf(outp, " 0x%016llx", t->extra_msr64);
499
500 if (do_nhm_cstates) {
501 if (!skip_c1)
523 outp += sprintf(outp, " %6.2f", 100.0 * t->c1/t->tsc);
502 outp += sprintf(outp, "%8.2f", 100.0 * t->c1/t->tsc);
524 else
503 else
525 outp += sprintf(outp, " ****");
504 outp += sprintf(outp, "********");
526 }
527
528 /* print per-core data only for 1st thread in core */
529 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
530 goto done;
531
532 if (do_nhm_cstates && !do_slm_cstates)
505 }
506
507 /* print per-core data only for 1st thread in core */
508 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
509 goto done;
510
511 if (do_nhm_cstates && !do_slm_cstates)
533 outp += sprintf(outp, " %6.2f", 100.0 * c->c3/t->tsc);
512 outp += sprintf(outp, "%8.2f", 100.0 * c->c3/t->tsc);
534 if (do_nhm_cstates)
513 if (do_nhm_cstates)
535 outp += sprintf(outp, " %6.2f", 100.0 * c->c6/t->tsc);
514 outp += sprintf(outp, "%8.2f", 100.0 * c->c6/t->tsc);
536 if (do_snb_cstates)
515 if (do_snb_cstates)
537 outp += sprintf(outp, " %6.2f", 100.0 * c->c7/t->tsc);
516 outp += sprintf(outp, "%8.2f", 100.0 * c->c7/t->tsc);
538
539 if (do_dts)
517
518 if (do_dts)
540 outp += sprintf(outp, " %4d", c->core_temp_c);
519 outp += sprintf(outp, "%8d", c->core_temp_c);
541
542 /* print per-package data only for 1st core in package */
543 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
544 goto done;
545
546 if (do_ptm)
520
521 /* print per-package data only for 1st core in package */
522 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
523 goto done;
524
525 if (do_ptm)
547 outp += sprintf(outp, " %4d", p->pkg_temp_c);
526 outp += sprintf(outp, "%8d", p->pkg_temp_c);
548
549 if (do_snb_cstates)
527
528 if (do_snb_cstates)
550 outp += sprintf(outp, " %6.2f", 100.0 * p->pc2/t->tsc);
529 outp += sprintf(outp, "%8.2f", 100.0 * p->pc2/t->tsc);
551 if (do_nhm_cstates && !do_slm_cstates)
530 if (do_nhm_cstates && !do_slm_cstates)
552 outp += sprintf(outp, " %6.2f", 100.0 * p->pc3/t->tsc);
531 outp += sprintf(outp, "%8.2f", 100.0 * p->pc3/t->tsc);
553 if (do_nhm_cstates && !do_slm_cstates)
532 if (do_nhm_cstates && !do_slm_cstates)
554 outp += sprintf(outp, " %6.2f", 100.0 * p->pc6/t->tsc);
533 outp += sprintf(outp, "%8.2f", 100.0 * p->pc6/t->tsc);
555 if (do_snb_cstates)
534 if (do_snb_cstates)
556 outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc);
535 outp += sprintf(outp, "%8.2f", 100.0 * p->pc7/t->tsc);
557 if (do_c8_c9_c10) {
536 if (do_c8_c9_c10) {
558 outp += sprintf(outp, " %6.2f", 100.0 * p->pc8/t->tsc);
559 outp += sprintf(outp, " %6.2f", 100.0 * p->pc9/t->tsc);
560 outp += sprintf(outp, " %6.2f", 100.0 * p->pc10/t->tsc);
537 outp += sprintf(outp, "%8.2f", 100.0 * p->pc8/t->tsc);
538 outp += sprintf(outp, "%8.2f", 100.0 * p->pc9/t->tsc);
539 outp += sprintf(outp, "%8.2f", 100.0 * p->pc10/t->tsc);
561 }
562
563 /*
564 * If measurement interval exceeds minimum RAPL Joule Counter range,
565 * indicate that results are suspect by printing "**" in fraction place.
566 */
540 }
541
542 /*
543 * If measurement interval exceeds minimum RAPL Joule Counter range,
544 * indicate that results are suspect by printing "**" in fraction place.
545 */
567 if (interval_float < rapl_joule_counter_range) {
568 fmt5 = " %5.2f";
569 fmt6 = " %6.2f";
570 } else {
571 fmt5 = " %3.0f**";
572 fmt6 = " %4.0f**";
573 }
546 if (interval_float < rapl_joule_counter_range)
547 fmt8 = "%8.2f";
548 else
549 fmt8 = " %6.0f**";
574
575 if (do_rapl && !rapl_joules) {
576 if (do_rapl & RAPL_PKG)
550
551 if (do_rapl && !rapl_joules) {
552 if (do_rapl & RAPL_PKG)
577 outp += sprintf(outp, fmt6, p->energy_pkg * rapl_energy_units / interval_float);
553 outp += sprintf(outp, fmt8, p->energy_pkg * rapl_energy_units / interval_float);
578 if (do_rapl & RAPL_CORES)
554 if (do_rapl & RAPL_CORES)
579 outp += sprintf(outp, fmt6, p->energy_cores * rapl_energy_units / interval_float);
555 outp += sprintf(outp, fmt8, p->energy_cores * rapl_energy_units / interval_float);
580 if (do_rapl & RAPL_GFX)
556 if (do_rapl & RAPL_GFX)
581 outp += sprintf(outp, fmt5, p->energy_gfx * rapl_energy_units / interval_float);
557 outp += sprintf(outp, fmt8, p->energy_gfx * rapl_energy_units / interval_float);
582 if (do_rapl & RAPL_DRAM)
558 if (do_rapl & RAPL_DRAM)
583 outp += sprintf(outp, fmt5, p->energy_dram * rapl_energy_units / interval_float);
559 outp += sprintf(outp, fmt8, p->energy_dram * rapl_energy_units / interval_float);
584 if (do_rapl & RAPL_PKG_PERF_STATUS)
560 if (do_rapl & RAPL_PKG_PERF_STATUS)
585 outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
561 outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
586 if (do_rapl & RAPL_DRAM_PERF_STATUS)
562 if (do_rapl & RAPL_DRAM_PERF_STATUS)
587 outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float);
563 outp += sprintf(outp, fmt8, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float);
588 } else {
589 if (do_rapl & RAPL_PKG)
564 } else {
565 if (do_rapl & RAPL_PKG)
590 outp += sprintf(outp, fmt6,
566 outp += sprintf(outp, fmt8,
591 p->energy_pkg * rapl_energy_units);
592 if (do_rapl & RAPL_CORES)
567 p->energy_pkg * rapl_energy_units);
568 if (do_rapl & RAPL_CORES)
593 outp += sprintf(outp, fmt6,
569 outp += sprintf(outp, fmt8,
594 p->energy_cores * rapl_energy_units);
595 if (do_rapl & RAPL_GFX)
570 p->energy_cores * rapl_energy_units);
571 if (do_rapl & RAPL_GFX)
596 outp += sprintf(outp, fmt5,
572 outp += sprintf(outp, fmt8,
597 p->energy_gfx * rapl_energy_units);
598 if (do_rapl & RAPL_DRAM)
573 p->energy_gfx * rapl_energy_units);
574 if (do_rapl & RAPL_DRAM)
599 outp += sprintf(outp, fmt5,
575 outp += sprintf(outp, fmt8,
600 p->energy_dram * rapl_energy_units);
601 if (do_rapl & RAPL_PKG_PERF_STATUS)
576 p->energy_dram * rapl_energy_units);
577 if (do_rapl & RAPL_PKG_PERF_STATUS)
602 outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
578 outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
603 if (do_rapl & RAPL_DRAM_PERF_STATUS)
579 if (do_rapl & RAPL_DRAM_PERF_STATUS)
604 outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float);
605 outp += sprintf(outp, fmt5, interval_float);
580 outp += sprintf(outp, fmt8, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float);
581 outp += sprintf(outp, fmt8, interval_float);
606
607 }
608done:
609 outp += sprintf(outp, "\n");
610
611 return 0;
612}
613

--- 1836 unchanged lines hidden (view full) ---

2450 }
2451}
2452
2453int main(int argc, char **argv)
2454{
2455 cmdline(argc, argv);
2456
2457 if (verbose)
582
583 }
584done:
585 outp += sprintf(outp, "\n");
586
587 return 0;
588}
589

--- 1836 unchanged lines hidden (view full) ---

2426 }
2427}
2428
2429int main(int argc, char **argv)
2430{
2431 cmdline(argc, argv);
2432
2433 if (verbose)
2458 fprintf(stderr, "turbostat v3.6 Dec 2, 2013"
2434 fprintf(stderr, "turbostat v3.7 Feb 6, 2014"
2459 " - Len Brown <lenb@kernel.org>\n");
2460
2461 turbostat_init();
2462
2463 /* dump counters and exit */
2464 if (dump_only)
2465 return get_and_dump_counters();
2466
2467 /*
2468 * if any params left, it must be a command to fork
2469 */
2470 if (argc - optind)
2471 return fork_it(argv + optind);
2472 else
2473 turbostat_loop();
2474
2475 return 0;
2476}
2435 " - Len Brown <lenb@kernel.org>\n");
2436
2437 turbostat_init();
2438
2439 /* dump counters and exit */
2440 if (dump_only)
2441 return get_and_dump_counters();
2442
2443 /*
2444 * if any params left, it must be a command to fork
2445 */
2446 if (argc - optind)
2447 return fork_it(argv + optind);
2448 else
2449 turbostat_loop();
2450
2451 return 0;
2452}