Commit 42fd37dc authored by Len Brown's avatar Len Brown
Browse files

tools/power turbostat: version 2025.06.08



Add initial DMR support, which required smarter RAPL probe
Fix AMD MSR RAPL energy reporting
Add RAPL power limit configuration output
Minor fixes

Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent d8c0f5d9
Loading
Loading
Loading
Loading
+36 −37
Original line number Diff line number Diff line
@@ -1091,7 +1091,6 @@ void probe_platform_features(unsigned int family, unsigned int model)
{
	int i;


	if (authentic_amd || hygon_genuine) {
		/* fallback to default features on unsupported models */
		force_load++;
@@ -1125,8 +1124,7 @@ void probe_platform_features(unsigned int family, unsigned int model)
	if (platform)
		return;

	fprintf(stderr, "Unsupported platform detected.\n"
		"\tSee RUN THE LATEST VERSION on turbostat(8)\n");
	fprintf(stderr, "Unsupported platform detected.\n\tSee RUN THE LATEST VERSION on turbostat(8)\n");
	exit(1);
}

@@ -1146,7 +1144,8 @@ char *progname;

#define CPU_SUBSET_MAXCPUS	8192	/* need to use before probe... */
cpu_set_t *cpu_present_set, *cpu_possible_set, *cpu_effective_set, *cpu_allowed_set, *cpu_affinity_set, *cpu_subset;
size_t cpu_present_setsize, cpu_possible_setsize, cpu_effective_setsize, cpu_allowed_setsize, cpu_affinity_setsize, cpu_subset_size;
size_t cpu_present_setsize, cpu_possible_setsize, cpu_effective_setsize, cpu_allowed_setsize, cpu_affinity_setsize,
    cpu_subset_size;
#define MAX_ADDED_THREAD_COUNTERS 24
#define MAX_ADDED_CORE_COUNTERS 8
#define MAX_ADDED_PACKAGE_COUNTERS 16
@@ -2373,8 +2372,7 @@ void help(void)
		"		  degrees Celsius\n"
		"  -h, --help\n"
		"		print this help message\n"
		"  -v, --version\n"
		"		print version information\n\nFor more help, run \"man turbostat\"\n");
		"  -v, --version\n\t\tprint version information\n\nFor more help, run \"man turbostat\"\n");
}

/*
@@ -3989,7 +3987,6 @@ void compute_average(struct thread_data *t, struct core_data *c, struct pkg_data
	if (average.threads.nmi_count > 9999999)
		sums_need_wide_columns = 1;


	average.cores.c3 /= topo.allowed_cores;
	average.cores.c6 /= topo.allowed_cores;
	average.cores.c7 /= topo.allowed_cores;
@@ -4812,7 +4809,6 @@ unsigned long pmt_read_counter(struct pmt_counter *ppmt, unsigned int domain_id)
	return (value & value_mask) >> value_shift;
}


/* Rapl domain enumeration helpers */
static inline int get_rapl_num_domains(void)
{
@@ -6822,8 +6818,10 @@ static void probe_intel_uncore_frequency_cluster(void)
		 * This allows "--show/--hide UncMHz" to be effective for
		 * the clustered MHz counters, as a group.
		 */
		if BIC_IS_ENABLED(BIC_UNCORE_MHZ)
			add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id);
		if BIC_IS_ENABLED
			(BIC_UNCORE_MHZ)
			    add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0,
					package_id);

		if (quiet)
			continue;
@@ -6895,17 +6893,21 @@ static void probe_graphics(void)
		else
			goto next;

		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms", gt0_is_gt ? GFX_rc6 : SAM_mc6);
		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms",
				gt0_is_gt ? GFX_rc6 : SAM_mc6);

		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt0/freq0/cur_freq", gt0_is_gt ? GFX_MHz : SAM_MHz);

		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt0/freq0/act_freq", gt0_is_gt ? GFX_ACTMHz : SAM_ACTMHz);
		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt0/freq0/act_freq",
				gt0_is_gt ? GFX_ACTMHz : SAM_ACTMHz);

		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt1/gtidle/idle_residency_ms", gt0_is_gt ? SAM_mc6 : GFX_rc6);
		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt1/gtidle/idle_residency_ms",
				gt0_is_gt ? SAM_mc6 : GFX_rc6);

		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt1/freq0/cur_freq", gt0_is_gt ? SAM_MHz : GFX_MHz);

		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt1/freq0/act_freq", gt0_is_gt ? SAM_ACTMHz : GFX_ACTMHz);
		set_graphics_fp("/sys/class/drm/card0/device/tile0/gt1/freq0/act_freq",
				gt0_is_gt ? SAM_ACTMHz : GFX_ACTMHz);

		goto end;
	}
@@ -7500,8 +7502,7 @@ static int dump_one_domain(char *domain_path)
		return 0;
	}

	for (constraint = 0;; constraint++)
	{
	for (constraint = 0;; constraint++) {
		snprintf(path, PATH_MAX, "%s/constraint_%d_time_window_us", domain_path, constraint);
		ret = fread_ull(path, &val);
		if (ret <= 0)
@@ -7552,8 +7553,7 @@ static int print_rapl_sysfs(void)

		/* Parse top level domains first, including package and psys */
		fread_str(path, str, PATH_MAX);
		if (strncmp(str, "package", strlen("package")) &&
		    strncmp(str, "psys", strlen("psys")))
		if (strncmp(str, "package", strlen("package")) && strncmp(str, "psys", strlen("psys")))
			continue;

		snprintf(path, PATH_MAX, "%s/%s", PATH_RAPL_SYSFS, entry->d_name);
@@ -9306,8 +9306,7 @@ int added_perf_counters_init_(struct perf_counter_info *pinfo)

			perf_type = read_perf_type(perf_device);
			if (perf_type == (unsigned int)-1) {
				warnx("%s: perf/%s/%s: failed to read %s",
				      __func__, perf_device, pinfo->event, "type");
				warnx("%s: perf/%s/%s: failed to read %s", __func__, perf_device, pinfo->event, "type");
				continue;
			}

@@ -9849,7 +9848,7 @@ int get_and_dump_counters(void)

void print_version()
{
	fprintf(outf, "turbostat version 2025.04.06 - Len Brown <lenb@kernel.org>\n");
	fprintf(outf, "turbostat version 2025.06.08 - Len Brown <lenb@kernel.org>\n");
}

#define COMMAND_LINE_SIZE 2048