diff options
author | Len Brown <len.brown@intel.com> | 2016-02-27 01:28:12 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2016-03-13 03:55:41 -0400 |
commit | fdf676e51f301d207586d9bac509b8ce055bae8a (patch) | |
tree | f4da5320e899ddd5cf760912d46924ef55a543ed /tools | |
parent | 27d47356b6dfa92042a17a0b474f08910d4c8e8f (diff) |
tools/power turbostat: show GFX%rc6
The column "GFX%c6" show the percentage of time the GPU
is in the "render C6" state, rc6. Deep package C-states on several
systems depend on the GPU being in RC6.
This information comes from the counter
/sys/class/drm/card0/power/rc6_residency_ms,
as read before and after the measurement interval.
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index d599f9131844..9896619e4382 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -90,6 +90,8 @@ char *output_buffer, *outp; | |||
90 | unsigned int do_rapl; | 90 | unsigned int do_rapl; |
91 | unsigned int do_dts; | 91 | unsigned int do_dts; |
92 | unsigned int do_ptm; | 92 | unsigned int do_ptm; |
93 | unsigned int do_gfx_rc6_ms; | ||
94 | unsigned long long gfx_cur_rc6_ms; | ||
93 | unsigned int do_gfx_mhz; | 95 | unsigned int do_gfx_mhz; |
94 | unsigned int gfx_cur_mhz; | 96 | unsigned int gfx_cur_mhz; |
95 | unsigned int tcc_activation_temp; | 97 | unsigned int tcc_activation_temp; |
@@ -185,6 +187,7 @@ struct pkg_data { | |||
185 | unsigned long long pkg_any_core_c0; | 187 | unsigned long long pkg_any_core_c0; |
186 | unsigned long long pkg_any_gfxe_c0; | 188 | unsigned long long pkg_any_gfxe_c0; |
187 | unsigned long long pkg_both_core_gfxe_c0; | 189 | unsigned long long pkg_both_core_gfxe_c0; |
190 | unsigned long long gfx_rc6_ms; | ||
188 | unsigned int gfx_mhz; | 191 | unsigned int gfx_mhz; |
189 | unsigned int package_id; | 192 | unsigned int package_id; |
190 | unsigned int energy_pkg; /* MSR_PKG_ENERGY_STATUS */ | 193 | unsigned int energy_pkg; /* MSR_PKG_ENERGY_STATUS */ |
@@ -365,6 +368,9 @@ void print_header(void) | |||
365 | if (do_ptm) | 368 | if (do_ptm) |
366 | outp += sprintf(outp, " PkgTmp"); | 369 | outp += sprintf(outp, " PkgTmp"); |
367 | 370 | ||
371 | if (do_gfx_rc6_ms) | ||
372 | outp += sprintf(outp, " GFX%%rc6"); | ||
373 | |||
368 | if (do_gfx_mhz) | 374 | if (do_gfx_mhz) |
369 | outp += sprintf(outp, " GFXMHz"); | 375 | outp += sprintf(outp, " GFXMHz"); |
370 | 376 | ||
@@ -614,6 +620,10 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
614 | if (do_ptm) | 620 | if (do_ptm) |
615 | outp += sprintf(outp, "%8d", p->pkg_temp_c); | 621 | outp += sprintf(outp, "%8d", p->pkg_temp_c); |
616 | 622 | ||
623 | /* GFXrc6 */ | ||
624 | if (do_gfx_rc6_ms) | ||
625 | outp += sprintf(outp, "%8.2f", 100.0 * p->gfx_rc6_ms / 1000.0 / interval_float); | ||
626 | |||
617 | /* GFXMHz */ | 627 | /* GFXMHz */ |
618 | if (do_gfx_mhz) | 628 | if (do_gfx_mhz) |
619 | outp += sprintf(outp, "%8d", p->gfx_mhz); | 629 | outp += sprintf(outp, "%8d", p->gfx_mhz); |
@@ -756,6 +766,7 @@ delta_package(struct pkg_data *new, struct pkg_data *old) | |||
756 | old->pc10 = new->pc10 - old->pc10; | 766 | old->pc10 = new->pc10 - old->pc10; |
757 | old->pkg_temp_c = new->pkg_temp_c; | 767 | old->pkg_temp_c = new->pkg_temp_c; |
758 | 768 | ||
769 | old->gfx_rc6_ms = new->gfx_rc6_ms - old->gfx_rc6_ms; | ||
759 | old->gfx_mhz = new->gfx_mhz; | 770 | old->gfx_mhz = new->gfx_mhz; |
760 | 771 | ||
761 | DELTA_WRAP32(new->energy_pkg, old->energy_pkg); | 772 | DELTA_WRAP32(new->energy_pkg, old->energy_pkg); |
@@ -922,6 +933,7 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data | |||
922 | p->rapl_dram_perf_status = 0; | 933 | p->rapl_dram_perf_status = 0; |
923 | p->pkg_temp_c = 0; | 934 | p->pkg_temp_c = 0; |
924 | 935 | ||
936 | p->gfx_rc6_ms = 0; | ||
925 | p->gfx_mhz = 0; | 937 | p->gfx_mhz = 0; |
926 | } | 938 | } |
927 | int sum_counters(struct thread_data *t, struct core_data *c, | 939 | int sum_counters(struct thread_data *t, struct core_data *c, |
@@ -975,6 +987,7 @@ int sum_counters(struct thread_data *t, struct core_data *c, | |||
975 | average.packages.energy_cores += p->energy_cores; | 987 | average.packages.energy_cores += p->energy_cores; |
976 | average.packages.energy_gfx += p->energy_gfx; | 988 | average.packages.energy_gfx += p->energy_gfx; |
977 | 989 | ||
990 | average.packages.gfx_rc6_ms = p->gfx_rc6_ms; | ||
978 | average.packages.gfx_mhz = p->gfx_mhz; | 991 | average.packages.gfx_mhz = p->gfx_mhz; |
979 | 992 | ||
980 | average.packages.pkg_temp_c = MAX(average.packages.pkg_temp_c, p->pkg_temp_c); | 993 | average.packages.pkg_temp_c = MAX(average.packages.pkg_temp_c, p->pkg_temp_c); |
@@ -1192,6 +1205,10 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
1192 | return -17; | 1205 | return -17; |
1193 | p->pkg_temp_c = tcc_activation_temp - ((msr >> 16) & 0x7F); | 1206 | p->pkg_temp_c = tcc_activation_temp - ((msr >> 16) & 0x7F); |
1194 | } | 1207 | } |
1208 | |||
1209 | if (do_gfx_rc6_ms) | ||
1210 | p->gfx_rc6_ms = gfx_cur_rc6_ms; | ||
1211 | |||
1195 | if (do_gfx_mhz) | 1212 | if (do_gfx_mhz) |
1196 | p->gfx_mhz = gfx_cur_mhz; | 1213 | p->gfx_mhz = gfx_cur_mhz; |
1197 | 1214 | ||
@@ -1845,6 +1862,29 @@ int snapshot_proc_interrupts(void) | |||
1845 | return 0; | 1862 | return 0; |
1846 | } | 1863 | } |
1847 | /* | 1864 | /* |
1865 | * snapshot_gfx_rc6_ms() | ||
1866 | * | ||
1867 | * record snapshot of | ||
1868 | * /sys/class/drm/card0/power/rc6_residency_ms | ||
1869 | * | ||
1870 | * return 1 if config change requires a restart, else return 0 | ||
1871 | */ | ||
1872 | int snapshot_gfx_rc6_ms(void) | ||
1873 | { | ||
1874 | FILE *fp; | ||
1875 | int retval; | ||
1876 | |||
1877 | fp = fopen_or_die("/sys/class/drm/card0/power/rc6_residency_ms", "r"); | ||
1878 | |||
1879 | retval = fscanf(fp, "%lld", &gfx_cur_rc6_ms); | ||
1880 | if (retval != 1) | ||
1881 | err(1, "GFX rc6"); | ||
1882 | |||
1883 | fclose(fp); | ||
1884 | |||
1885 | return 0; | ||
1886 | } | ||
1887 | /* | ||
1848 | * snapshot_gfx_mhz() | 1888 | * snapshot_gfx_mhz() |
1849 | * | 1889 | * |
1850 | * record snapshot of | 1890 | * record snapshot of |
@@ -1879,6 +1919,9 @@ int snapshot_proc_sysfs_files(void) | |||
1879 | if (snapshot_proc_interrupts()) | 1919 | if (snapshot_proc_interrupts()) |
1880 | return 1; | 1920 | return 1; |
1881 | 1921 | ||
1922 | if (do_gfx_rc6_ms) | ||
1923 | snapshot_gfx_rc6_ms(); | ||
1924 | |||
1882 | if (do_gfx_mhz) | 1925 | if (do_gfx_mhz) |
1883 | snapshot_gfx_mhz(); | 1926 | snapshot_gfx_mhz(); |
1884 | 1927 | ||
@@ -3157,6 +3200,8 @@ void process_cpuid() | |||
3157 | if (has_skl_msrs(family, model)) | 3200 | if (has_skl_msrs(family, model)) |
3158 | calculate_tsc_tweak(); | 3201 | calculate_tsc_tweak(); |
3159 | 3202 | ||
3203 | do_gfx_rc6_ms = !access("/sys/class/drm/card0/power/rc6_residency_ms", R_OK); | ||
3204 | |||
3160 | do_gfx_mhz = !access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK); | 3205 | do_gfx_mhz = !access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK); |
3161 | 3206 | ||
3162 | return; | 3207 | return; |