turbostat.c (8201a0285789fade1c5b031914577e2b27a64f05) | turbostat.c (fecb3bc839df64761cc63c9ee9b45c1cad36aee8) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * turbostat -- show CPU frequency and C-state residency 4 * on modern Intel and AMD processors. 5 * 6 * Copyright (c) 2013 Intel Corporation. 7 * Len Brown <len.brown@intel.com> 8 */ --- 3669 unchanged lines hidden (view full) --- 3678 case INTEL_FAM6_XEON_PHI_KNL: /* Knights Landing */ 3679 return 1; 3680 default: 3681 return 0; 3682 } 3683} 3684 3685static void | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * turbostat -- show CPU frequency and C-state residency 4 * on modern Intel and AMD processors. 5 * 6 * Copyright (c) 2013 Intel Corporation. 7 * Len Brown <len.brown@intel.com> 8 */ --- 3669 unchanged lines hidden (view full) --- 3678 case INTEL_FAM6_XEON_PHI_KNL: /* Knights Landing */ 3679 return 1; 3680 default: 3681 return 0; 3682 } 3683} 3684 3685static void |
3686remove_underbar(char *s) 3687{ 3688 char *to = s; 3689 3690 while (*s) { 3691 if (*s != '_') 3692 *to++ = *s; 3693 s++; 3694 } 3695 3696 *to = 0; 3697} 3698 3699static void |
|
3686dump_cstate_pstate_config_info(unsigned int family, unsigned int model) 3687{ 3688 if (!do_nhm_platform_info) 3689 return; 3690 3691 dump_nhm_platform_info(); 3692 3693 if (has_hsw_turbo_ratio_limit(family, model)) --- 65 unchanged lines hidden (view full) --- 3759 3760 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */ 3761 sp = strchr(name_buf, '-'); 3762 if (!sp) 3763 sp = strchrnul(name_buf, '\n'); 3764 *sp = '\0'; 3765 fclose(input); 3766 | 3700dump_cstate_pstate_config_info(unsigned int family, unsigned int model) 3701{ 3702 if (!do_nhm_platform_info) 3703 return; 3704 3705 dump_nhm_platform_info(); 3706 3707 if (has_hsw_turbo_ratio_limit(family, model)) --- 65 unchanged lines hidden (view full) --- 3773 3774 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */ 3775 sp = strchr(name_buf, '-'); 3776 if (!sp) 3777 sp = strchrnul(name_buf, '\n'); 3778 *sp = '\0'; 3779 fclose(input); 3780 |
3781 remove_underbar(name_buf); 3782 |
|
3767 sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc", 3768 base_cpu, state); 3769 input = fopen(path, "r"); 3770 if (input == NULL) 3771 continue; 3772 if (!fgets(desc, sizeof(desc), input)) 3773 err(1, "%s: failed to read file", path); 3774 --- 2050 unchanged lines hidden (view full) --- 5825 5826 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */ 5827 sp = strchr(name_buf, '-'); 5828 if (!sp) 5829 sp = strchrnul(name_buf, '\n'); 5830 *sp = '%'; 5831 *(sp + 1) = '\0'; 5832 | 3783 sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc", 3784 base_cpu, state); 3785 input = fopen(path, "r"); 3786 if (input == NULL) 3787 continue; 3788 if (!fgets(desc, sizeof(desc), input)) 3789 err(1, "%s: failed to read file", path); 3790 --- 2050 unchanged lines hidden (view full) --- 5841 5842 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */ 5843 sp = strchr(name_buf, '-'); 5844 if (!sp) 5845 sp = strchrnul(name_buf, '\n'); 5846 *sp = '%'; 5847 *(sp + 1) = '\0'; 5848 |
5849 remove_underbar(name_buf); 5850 |
|
5833 fclose(input); 5834 5835 sprintf(path, "cpuidle/state%d/time", state); 5836 5837 if (is_deferred_skip(name_buf)) 5838 continue; 5839 5840 add_counter(0, path, name_buf, 64, SCOPE_CPU, COUNTER_USEC, --- 11 unchanged lines hidden (view full) --- 5852 err(1, "%s: failed to read file", path); 5853 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */ 5854 sp = strchr(name_buf, '-'); 5855 if (!sp) 5856 sp = strchrnul(name_buf, '\n'); 5857 *sp = '\0'; 5858 fclose(input); 5859 | 5851 fclose(input); 5852 5853 sprintf(path, "cpuidle/state%d/time", state); 5854 5855 if (is_deferred_skip(name_buf)) 5856 continue; 5857 5858 add_counter(0, path, name_buf, 64, SCOPE_CPU, COUNTER_USEC, --- 11 unchanged lines hidden (view full) --- 5870 err(1, "%s: failed to read file", path); 5871 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */ 5872 sp = strchr(name_buf, '-'); 5873 if (!sp) 5874 sp = strchrnul(name_buf, '\n'); 5875 *sp = '\0'; 5876 fclose(input); 5877 |
5878 remove_underbar(name_buf); 5879 |
|
5860 sprintf(path, "cpuidle/state%d/usage", state); 5861 5862 if (is_deferred_skip(name_buf)) 5863 continue; 5864 5865 add_counter(0, path, name_buf, 64, SCOPE_CPU, COUNTER_ITEMS, 5866 FORMAT_DELTA, SYSFS_PERCPU); 5867 } --- 247 unchanged lines hidden --- | 5880 sprintf(path, "cpuidle/state%d/usage", state); 5881 5882 if (is_deferred_skip(name_buf)) 5883 continue; 5884 5885 add_counter(0, path, name_buf, 64, SCOPE_CPU, COUNTER_ITEMS, 5886 FORMAT_DELTA, SYSFS_PERCPU); 5887 } --- 247 unchanged lines hidden --- |