From dc38b8f98be1fa2d95a33886f78873a8defbcff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E9=BE=99?= Date: Sun, 26 Jan 2025 10:45:36 +0800 Subject: [PATCH] add some quick comple guide --- README.en.md | 18 ++++++++++++++++++ README.md | 15 +++++++++++++++ docs/{Details.md => detail_usage.md} | 0 3 files changed, 33 insertions(+) rename docs/{Details.md => detail_usage.md} (100%) diff --git a/README.en.md b/README.en.md index 9b77a24..abfc987 100644 --- a/README.en.md +++ b/README.en.md @@ -164,3 +164,21 @@ def Counting(): kperf.disable(pd) kperf.close(pd) ``` + +#### Quick Run Reference for Example Code: + +* **For C Example Code:** +You can place the example code inside a main function and include the relevant header files for the dynamic library (#include "symbol.h", #include "pmu.h", #include "pcerrc.h"). Then, compile and link the dynamic library using g++ to generate an executable file for running. + +Compilation Command Reference: +```bash +gcc -o main main.c -I /install_path/include -L /install_path/lib -lkperf -lsym +``` + +* **For Python Example Code:** +You can place the example code inside a main function and import the relevant packages for the dynamic library (import kperf, import ksym). Then, run the Python file directly. + +Run Command Reference: +```bash +python main.py +``` \ No newline at end of file diff --git a/README.md b/README.md index a2ec827..4b5fb2c 100644 --- a/README.md +++ b/README.md @@ -166,3 +166,18 @@ def Counting(): kperf.close(pd) ``` + +#### 示例代码快速运行参考: +* **针对C示例代码:** +可以将示例代码放到一个main函数中,并引用此动态库相关的头文件(#include "symbol.h"、#include "pmu.h"、#include "pcerrc.h"),在使用g++编译链接此动态库,生成可执行文件即可运行。 +编译指令参考: +```bash +gcc -o main main.c -I /install_path/include -L /install_path/lib -lkperf -lsym +``` + +* **针对python示例代码:** +可以将示例代码放到一个main函数中,并导入此动态库相关的头文件包(import kperf、import ksym),在运行此python文件即可。 +运行指令参考: +```bash +python main.py +``` \ No newline at end of file diff --git a/docs/Details.md b/docs/detail_usage.md similarity index 100% rename from docs/Details.md rename to docs/detail_usage.md -- Gitee