Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/power turbostat: Fix incorrect sorting of PMT telemetry

The pmt_telemdir_sort() comparison function was returning a boolean
value (0 or 1) instead of the required negative, zero, or positive
value for proper sorting. This caused unpredictable and incorrect
ordering of telemetry directories named telem0, telem1, ..., telemN.
Update the comparison logic to return -1, 0, or 1 based on the
numerical value extracted from the directory name, ensuring correct
numerical ordering when using scandir.

This change improves stability and correctness when iterating PMT
telemetry directories.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Kaushlendra Kumar and committed by
Len Brown
cafb47be 038d61fd

+1 -1
+1 -1
tools/power/x86/turbostat/turbostat.c
··· 1649 1649 sscanf((*a)->d_name, "telem%u", &aidx); 1650 1650 sscanf((*b)->d_name, "telem%u", &bidx); 1651 1651 1652 - return aidx >= bidx; 1652 + return (aidx > bidx) ? 1 : (aidx < bidx) ? -1 : 0; 1653 1653 } 1654 1654 1655 1655 const struct dirent *pmt_diriter_next(struct pmt_diriter_t *iter)