From 4a5a6d613a08dc4633ba951f4309976f9e840242 Mon Sep 17 00:00:00 2001 From: wuying39 Date: Tue, 18 Nov 2025 20:49:47 +0800 Subject: [PATCH] modify parameter validation of cache collect tool and README --- README.en.md | 4 + README.md | 3 + tools/cache_collect/README.en.md | 145 +++++++++++++++++++++++++++ tools/cache_collect/README.md | 80 +++++++-------- tools/cache_collect/collect.cpp | 2 +- tools/cache_collect/collect_args.cpp | 94 +++++++++++------ tools/cache_collect/collect_args.h | 12 ++- 7 files changed, 264 insertions(+), 76 deletions(-) create mode 100644 tools/cache_collect/README.en.md diff --git a/README.en.md b/README.en.md index ffc0d13..7d31cf7 100644 --- a/README.en.md +++ b/README.en.md @@ -55,6 +55,10 @@ Minimum required GCC version: - gcc-4.8.5 and glibc-2.17. +Maximum supported GCC version: + +- gcc-12.2.0 and glibc-2.36. + Minimum required Python version: - python-3.6. diff --git a/README.md b/README.md index c441df5..be4553c 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,9 @@ v1.0: 最低依赖gcc版本: - gcc-4.8.5 和 glibc-2.17 +最高支持gcc版本: +- gcc-12.2.0 和 glibc-2.36 + 最低依赖python版本: - python-3.6 diff --git a/tools/cache_collect/README.en.md b/tools/cache_collect/README.en.md new file mode 100644 index 0000000..b5fbdaa --- /dev/null +++ b/tools/cache_collect/README.en.md @@ -0,0 +1,145 @@ +# Cache Collect Tool +### Description +This tool is designed to collect L2I cache, l2D cache information of go program. + +1. It generates statistics of hotspots from the function and instruction perspectives. + +2. It reports the L2I cache miss ratio, L2D cache miss ratio, and IPC (Instructions Per Cycle) for each process. + +In L2I cache collect mode, the corresponding data can be output as a txt file for BOLT in the work directory. +``` +Format: 1 [funcName] [offset] [number] +``` +[number] is the sample count for [funcName] at [offset] + +### Build +Build the libkperf tool first: +``` +bash build.sh +``` + +then: +``` +cd tools/cache_collect +mkdir build && cd build +cmake .. +make +``` + +### Run +Use './cache_collect --help/-h' to view the help information. + +``` + Usage: ./cache_collect --pid/-p [options] + + Required: + --pid/-p : Target process ID(s). Multiple IDs can be separated by ',' + Optional: + --duration/-d : Set collection time of hotspots. Unit: s, default: 10 + --level/-l : Set to 'inst' for instruction-level summary. Default: function-level summary + --mode/-m : Set to 'dcache' to collect L2D cache data. Default: L2I cache data + --interval/-i : Interval for reading the ring buffer. Unit: ms, default: 1000 + --frequency/-f : Sampling frequency, default: 1000 + --bolt/-b