tools/power/x86/intel-speed-select/isst-display.c
Source file repositories/reference/linux-study-clean/tools/power/x86/intel-speed-select/isst-display.c
File Facts
- System
- Linux kernel
- Corpus path
tools/power/x86/intel-speed-select/isst-display.c- Extension
.c- Size
- 23389 bytes
- Lines
- 805
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
isst.h
Detected Declarations
function Copyrightfunction printcpumaskfunction format_and_print_txtfunction format_and_printfunction print_package_infofunction _isst_pbf_display_informationfunction _isst_fact_display_informationfunction isst_ctdp_display_core_infofunction isst_ctdp_display_informationfunction isst_ctdp_display_information_startfunction isst_ctdp_display_information_endfunction isst_pbf_display_informationfunction isst_fact_display_informationfunction isst_clos_display_informationfunction isst_clos_display_clos_informationfunction isst_clos_display_assoc_informationfunction isst_display_resultfunction isst_display_error_info_messagefunction isst_trl_display_information
Annotated Snippet
if (!first) {
index = snprintf(&str[curr_index],
str_len - curr_index, ",");
curr_index += index;
if (curr_index >= str_len)
break;
}
index = snprintf(&str[curr_index], str_len - curr_index, "%d",
i);
curr_index += index;
if (curr_index >= str_len)
break;
first = 0;
}
}
static void printcpumask(int str_len, char *str, int mask_size,
cpu_set_t *cpu_mask)
{
int i, max_cpus = get_topo_max_cpus();
unsigned int *mask;
int size, index, curr_index;
size = max_cpus / (sizeof(unsigned int) * 8);
if (max_cpus % (sizeof(unsigned int) * 8))
size++;
mask = calloc(size, sizeof(unsigned int));
if (!mask)
return;
for (i = 0; i < max_cpus; ++i) {
int mask_index, bit_index;
if (!CPU_ISSET_S(i, mask_size, cpu_mask))
continue;
mask_index = i / (sizeof(unsigned int) * 8);
bit_index = i % (sizeof(unsigned int) * 8);
mask[mask_index] |= BIT(bit_index);
}
curr_index = 0;
for (i = size - 1; i >= 0; --i) {
index = snprintf(&str[curr_index], str_len - curr_index, "%08x",
mask[i]);
curr_index += index;
if (curr_index >= str_len)
break;
if (i) {
strncat(&str[curr_index], ",", str_len - curr_index);
curr_index++;
}
if (curr_index >= str_len)
break;
}
free(mask);
}
static void format_and_print_txt(FILE *outf, int level, char *header,
char *value)
{
char *spaces = " ";
static char delimiters[256];
int i, j = 0;
if (!level)
return;
if (level == 1) {
strcpy(delimiters, " ");
} else {
for (i = 0; i < level - 1; ++i)
j += snprintf(&delimiters[j], sizeof(delimiters) - j,
"%s", spaces);
}
if (header && value) {
fprintf(outf, "%s", delimiters);
fprintf(outf, "%s:%s\n", header, value);
} else if (header) {
fprintf(outf, "%s", delimiters);
fprintf(outf, "%s\n", header);
}
}
static int last_level;
static void format_and_print(FILE *outf, int level, char *header, char *value)
{
Annotation
- Immediate include surface: `isst.h`.
- Detected declarations: `function Copyright`, `function printcpumask`, `function format_and_print_txt`, `function format_and_print`, `function print_package_info`, `function _isst_pbf_display_information`, `function _isst_fact_display_information`, `function isst_ctdp_display_core_info`, `function isst_ctdp_display_information`, `function isst_ctdp_display_information_start`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.