Commit a80e5347 authored by Len Brown's avatar Len Brown
Browse files

tools/power turbostat: version 2025.01.14



Fix checkpatch whitespace issues since 2024.11.30

Summary of Changes since 2024.11.30:

	Enable SysWatt by default.

	Add initial PTL, CWF platform support.

	Refuse to run on unsupported platforms without --force
	to avoid not-so-useful measurements mistakenly made
	using obsolete versions.

	Harden initial PMT code in response to early use.

Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 83fbeb9f
Loading
Loading
Loading
Loading
+16 −20
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * turbostat -- show CPU frequency and C-state residency
 * on modern Intel and AMD processors.
 *
 * Copyright (c) 2024 Intel Corporation.
 * Copyright (c) 2025 Intel Corporation.
 * Len Brown <len.brown@intel.com>
 */

@@ -1593,8 +1593,7 @@ struct pmt_counter {
 * PMT telemetry directory iterator.
 * Used to iterate telemetry files in sysfs in correct order.
 */
struct pmt_diriter_t
{
struct pmt_diriter_t {
	DIR *dir;
	struct dirent **namelist;
	unsigned int num_names;
@@ -1604,6 +1603,7 @@ struct pmt_diriter_t
int pmt_telemdir_filter(const struct dirent *e)
{
	unsigned int dummy;

	return sscanf(e->d_name, "telem%u", &dummy);
}

@@ -2302,7 +2302,7 @@ void help(void)
		"  -h, --help\n"
		"		print this help message\n"
		"  -v, --version\n"
		"		print version information\n" "\n" "For more help, run \"man turbostat\"\n");
		"		print version information\n\nFor more help, run \"man turbostat\"\n");
}

/*
@@ -9054,17 +9054,15 @@ struct pmt_mmio *pmt_mmio_open(unsigned int target_guid)
	}

	for ( ; entry != NULL; entry = pmt_diriter_next(&pmt_iter)) {
		if (fstatat(dirfd(pmt_iter.dir), entry->d_name, &st, 0) == -1) {
		if (fstatat(dirfd(pmt_iter.dir), entry->d_name, &st, 0) == -1)
			break;
		}

		if (!S_ISDIR(st.st_mode))
			continue;

		fd_telem_dir = openat(dirfd(pmt_iter.dir), entry->d_name, O_RDONLY);
		if (fd_telem_dir == -1) {
		if (fd_telem_dir == -1)
			break;
		}

		if (parse_telem_info_file(fd_telem_dir, "guid", "%lx", &guid)) {
			close(fd_telem_dir);
@@ -9425,7 +9423,7 @@ int get_and_dump_counters(void)

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

#define COMMAND_LINE_SIZE 2048
@@ -9822,9 +9820,8 @@ int pmt_parse_from_path(const char *target_path, unsigned int *out_guid, unsigne
	     dirname = pmt_diriter_next(&pmt_iter)) {

		fd_telem_dir = openat(dirfd(pmt_iter.dir), dirname->d_name, O_RDONLY | O_DIRECTORY);
		if (fd_telem_dir == -1) {
		if (fd_telem_dir == -1)
			continue;
		}

		if (parse_telem_info_file(fd_telem_dir, "guid", "%lx", &guid)) {
			fprintf(stderr, "%s: Failed to parse the guid file: %s", __func__, strerror(errno));
@@ -9962,9 +9959,8 @@ void parse_add_command_pmt(char *add_command)
			goto next;
		}

		if (sscanf(add_command, "seq=%x", &seq) == 1) {
		if (sscanf(add_command, "seq=%x", &seq) == 1)
			goto next;
		}

		if (strncmp(add_command, direct_path_prefix, strlen(direct_path_prefix)) == 0) {
			direct_path = add_command + strlen(direct_path_prefix);