Skip to content

Commit

Permalink
Add sysfeature tsc support for AMD
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatix committed Dec 10, 2024
1 parent 006c833 commit 7f9d735
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include <sysFeatures_types.h>

extern const _SysFeatureList likwid_sysft_intel_cpu_freq_feature_list;
extern const _SysFeatureList likwid_sysft_x86_cpu_freq_feature_list;

#endif //SYSFEATURES_INTEL_FREQ_H
4 changes: 4 additions & 0 deletions src/sysFeatures_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <sysFeatures_amd_hsmp.h>
#include <sysFeatures_amd_rapl.h>
#include <sysFeatures_amd_thermal.h>
#include <sysFeatures_x86_tsc.h>
#include <sysFeatures_common.h>
#include <topology.h>
#include <registers.h>
Expand Down Expand Up @@ -284,6 +285,7 @@ static const _SysFeatureList* amd_k17_cpu_feature_inputs[] = {
//&amd_k19_cpu_l1dflush_feature_list,
&amd_k17_cpu_hwconfig_feature_list,
&likwid_sysft_amd_k10_cpu_thermal_feature_list,
&likwid_sysft_x86_cpu_freq_feature_list,
NULL,
};

Expand All @@ -292,6 +294,7 @@ static const _SysFeatureList* amd_k19_zen3_cpu_feature_inputs[] = {
&amd_k19_cpu_speculation_feature_list,
&amd_k17_cpu_hwconfig_feature_list,
&likwid_sysft_amd_k10_cpu_thermal_feature_list,
&likwid_sysft_x86_cpu_freq_feature_list,
NULL,
};

Expand All @@ -301,6 +304,7 @@ static const _SysFeatureList* amd_k19_zen4_cpu_feature_inputs[] = {
&amd_k19_cpu_l1dflush_feature_list,
&amd_k17_cpu_hwconfig_feature_list,
&likwid_sysft_amd_k10_cpu_thermal_feature_list,
&likwid_sysft_x86_cpu_freq_feature_list,
NULL,
};

Expand Down
10 changes: 5 additions & 5 deletions src/sysFeatures_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <sysFeatures_intel_uncorefreq.h>
#include <sysFeatures_intel_spec_ctrl.h>
#include <sysFeatures_intel_thermal.h>
#include <sysFeatures_intel_freq.h>
#include <sysFeatures_x86_tsc.h>

static const _HWArchFeatures intel_arch_features[];

Expand Down Expand Up @@ -83,7 +83,7 @@ static const _SysFeatureList* intel_arch_feature_inputs[] = {
&likwid_sysft_intel_uncorefreq_feature_list,
&likwid_sysft_intel_cpu_spec_ctrl_feature_list,
&likwid_sysft_intel_cpu_thermal_feature_list,
&likwid_sysft_intel_cpu_freq_feature_list,
&likwid_sysft_x86_cpu_freq_feature_list,
NULL,
};

Expand All @@ -93,7 +93,7 @@ static const _SysFeatureList* intel_8f_arch_feature_inputs[] = {
&likwid_sysft_intel_cpu_ida_feature_list,
&likwid_sysft_intel_cpu_turbo_feature_list,
&likwid_sysft_intel_cpu_spec_ctrl_feature_list,
&likwid_sysft_intel_cpu_freq_feature_list,
&likwid_sysft_x86_cpu_freq_feature_list,
NULL,
};

Expand All @@ -102,7 +102,7 @@ static const _SysFeatureList* intel_knl_arch_feature_inputs[] = {
&likwid_sysft_intel_cpu_ida_feature_list,
&likwid_sysft_intel_cpu_turbo_feature_list,
&likwid_sysft_intel_cpu_spec_ctrl_feature_list,
&likwid_sysft_intel_cpu_freq_feature_list,
&likwid_sysft_x86_cpu_freq_feature_list,
NULL,
};

Expand All @@ -111,7 +111,7 @@ static const _SysFeatureList* intel_core2_arch_feature_inputs[] = {
&likwid_sysft_intel_cpu_ida_feature_list,
&likwid_sysft_intel_cpu_turbo_feature_list,
&likwid_sysft_intel_cpu_spec_ctrl_feature_list,
&likwid_sysft_intel_cpu_freq_feature_list,
&likwid_sysft_x86_cpu_freq_feature_list,
NULL,
};

Expand Down
10 changes: 5 additions & 5 deletions src/sysFeatures_intel_freq.c → src/sysFeatures_x86_tsc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <sysFeatures_intel_freq.h>
#include <sysFeatures_x86_tsc.h>

#include <bitUtil.h>
#include <cpuid.h>
Expand Down Expand Up @@ -106,15 +106,15 @@ static int invariant_getter(LikwidDevice_t device, char **value)
return likwid_sysft_uint64_to_string(field32(edx, 8, 1), value);
}

static _SysFeature intel_freq_features[] = {
static _SysFeature freq_features[] = {
{"denominator", "tsc", "Denominator of Time Stamp Counter ratio", denominator_getter, NULL, DEVICE_TYPE_SOCKET, ratio_tester},
{"numerator", "tsc", "Numerator of Time Stamp Counter ratio", numerator_getter, NULL, DEVICE_TYPE_SOCKET, ratio_tester},
{"crystal_freq", "tsc", "Crystal frequency of Time Stamp Counter", crystal_freq_getter, NULL, DEVICE_TYPE_SOCKET, crystal_freq_tester, "Hz"},
{"freq", "tsc", "Effective frequency of Time Stamp Counter", freq_getter, NULL, DEVICE_TYPE_SOCKET, freq_tester, "Hz"},
{"invariant", "tsc", "Time Stamp Counter operates at a fixed frequency", invariant_getter, NULL, DEVICE_TYPE_SOCKET, invariant_tester},
};

const _SysFeatureList likwid_sysft_intel_cpu_freq_feature_list = {
.num_features = ARRAY_COUNT(intel_freq_features),
.features = intel_freq_features,
const _SysFeatureList likwid_sysft_x86_cpu_freq_feature_list = {
.num_features = ARRAY_COUNT(freq_features),
.features = freq_features,
};

0 comments on commit 7f9d735

Please sign in to comment.