diff --git a/include/pcerrc.h b/include/pcerrc.h index bebe2353f60b8634c8c3b5dcf3f0d8f529014724..71efd6e7fc05e9ac3f47fd8d323b6566dff6bf51 100644 --- a/include/pcerrc.h +++ b/include/pcerrc.h @@ -129,6 +129,7 @@ extern "C" { #define LIBPERF_ERR_BUFFER_CORRUPTED 1082 #define LIBPERF_ERR_NOT_SUPPORT_HWMETRIC 1083 #define LIBPERF_ERR_INVALID_HWMETRIC_ATTR 1084 +#define LIBPERF_ERR_INVALID_MIN_LATENCY 1085 #define UNKNOWN_ERROR 9999 diff --git a/pmu/pmu.cpp b/pmu/pmu.cpp index 259a3b99216eaf1c0b188c4f172df51db90020a2..012822b0bf10cd6a17bf12ea646a542519983a97 100644 --- a/pmu/pmu.cpp +++ b/pmu/pmu.cpp @@ -255,6 +255,10 @@ static int CheckCollectTypeConfig(enum PmuTaskType collectType, struct PmuAttr * New(LIBPERF_ERR_INVALID_CGROUP_LIST, "SPE mode only support one cgroup"); return LIBPERF_ERR_INVALID_CGROUP_LIST; } + if (collectType == SPE_SAMPLING && (attr->minLatency > 4095 || attr->minLatency < 0)) { + New(LIBPERF_ERR_INVALID_MIN_LATENCY, "Invalid min_latency: value must be between 0 and 4095"); + return LIBPERF_ERR_INVALID_MIN_LATENCY; + } return SUCCESS; } diff --git a/pmu/spe.cpp b/pmu/spe.cpp index ca4f9ed46d25cacc3e7caa77b46e49a5eebc5020..6cbc35925f8ba694c8fb13cf9f912ff3c52f830b 100644 --- a/pmu/spe.cpp +++ b/pmu/spe.cpp @@ -58,7 +58,6 @@ static int OpenSpeEvent(PmuEvt *pmuAttr, int cpu) attr.config2 = pmuAttr->config2; /* min_latency */ attr.exclude_guest = 1; attr.disabled = 1; - attr.freq = pmuAttr->useFreq; attr.sample_period = pmuAttr->period; attr.sample_type = PERF_SAMPLE_TID; attr.sample_id_all = 1; diff --git a/python/modules/kperf/perror.py b/python/modules/kperf/perror.py index ccdaba9aae1c22a1a621a2b4bdbaa31a292bb166..8c29f5a643f01de62b8167b9788b61d062b58a86 100644 --- a/python/modules/kperf/perror.py +++ b/python/modules/kperf/perror.py @@ -128,6 +128,7 @@ class Error: LIBPERF_ERR_BUFFER_CORRUPTED = 1082 LIBPERF_ERR_NOT_SUPPORT_HWMETRIC = 1083 LIBPERF_ERR_INVALID_HWMETRIC_ATTR = 1084 + LIBPERF_ERR_INVALID_MIN_LATENCY = 1085 UNKNOWN_ERROR = 9999 diff --git a/tools/cache_collect/collect_args.cpp b/tools/cache_collect/collect_args.cpp index 37ac8d1bbd8ae05a67e9a38ee7115b20c811aa58..eebd8c046f14827276ddf8dcb250980cb57adaf2 100644 --- a/tools/cache_collect/collect_args.cpp +++ b/tools/cache_collect/collect_args.cpp @@ -159,7 +159,7 @@ bool CollectArgs::ParsePidList() pid = std::stoi(pidStr); } catch (const std::invalid_argument& e) { std::cerr << "Error: failed to parse pid from input parameter: '" << pidStr - << "' .Reason: " << e.what() << ". Expected an integer.\n"; + << "'. Reason: " << e.what() << ". Expected an integer.\n"; return false; } pids.push_back(pid); @@ -169,7 +169,7 @@ bool CollectArgs::ParsePidList() void CollectArgs::printUsage() { - std::cerr << "Usage: cache_collect --pid/-p [options]\n\n"; + std::cerr << "Usage: ./cache_collect --pid/-p [options]\n\n"; std::cerr << "Required:\n"; std::cerr << " --pid/-p : Target process ID(s). Multiple IDs can be separated by ','\n"; @@ -182,6 +182,6 @@ void CollectArgs::printUsage() std::cerr << " --bolt/-b