From 6837aa5133493d218d79e4ff4f49950558ae8306 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=99=97=E5=8D=9A?= <albert_xuu@163.com>
Date: Sat, 28 Sep 2024 16:56:14 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?=
 =?UTF-8?q?=E8=84=9A=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ...60\346\215\256\345\205\263\350\201\224.md" |  9 ---
 .../ebpf_test.sh"                             | 27 ++++++++
 .../test_keytime.sh"                          | 66 ++++++++++++++++++
 .../test_lock.sh"                             | 67 +++++++++++++++++++
 4 files changed, 160 insertions(+), 9 deletions(-)
 create mode 100755 "eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/ebpf_test.sh"
 create mode 100755 "eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_keytime.sh"
 create mode 100755 "eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_lock.sh"

diff --git "a/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/docs/\346\265\213\350\257\225\344\270\216\346\225\260\346\215\256\345\205\263\350\201\224.md" "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/docs/\346\265\213\350\257\225\344\270\216\346\225\260\346\215\256\345\205\263\350\201\224.md"
index 6f4cf945f..d0fe06640 100644
--- "a/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/docs/\346\265\213\350\257\225\344\270\216\346\225\260\346\215\256\345\205\263\350\201\224.md"
+++ "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/docs/\346\265\213\350\257\225\344\270\216\346\225\260\346\215\256\345\205\263\350\201\224.md"
@@ -933,11 +933,6 @@ lttng监测到的结果:
 
 通过lttng以及syscall_image的对比,可以证明我们的syscall_image工具在逻辑上是正确无误的;
 
-其中还有很多细节没有展示,可以在以下几个原始数据中进行对比:
-
-- 
-- 
-
 #### 4.2.2 数据正确性
 
 前面我们已经对syscall-image工具进行了逻辑真确性验证,接下来我们通过对比一些数据来验证数据正确性,这些数据包括:
@@ -973,10 +968,6 @@ TIME      TGID    PID     1st/num         2nd/num         3nd/num         | P_AV
 
 通过以上数据的对比,我们可以得出结论,syscall_image在数据层面是真实可靠的,他与lttng之间存在0.0000255%的误差,是可以忽略的。
 
-详细的原始数据可在这里查看:
-
-- 
-- 
 
 ### 4.3 关键数据点的关联关系
 
diff --git "a/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/ebpf_test.sh" "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/ebpf_test.sh"
new file mode 100755
index 000000000..db7a97b50
--- /dev/null
+++ "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/ebpf_test.sh"
@@ -0,0 +1,27 @@
+#!/bin/bash
+SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+OUTPUT_DIR="$SCRIPT_DIR/lttng-traces"
+# 获取目标进程的 PID
+TARGET_PID=$(pidof test_proc_image)
+
+if [ -z "$TARGET_PID" ]; then
+    echo "目标进程未运行,请先启动目标进程。"
+    exit 1
+fi
+echo "测试程序 PID: $TARGET_PID"
+# 运行 eBPF 程序并将输出重定向到文件
+
+cd /home/xhb/lmp2/lmp/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/
+sudo ./proc_image -k > $OUTPUT_DIR/output.log &
+PROC_IMAGE_PID=$!
+sleep 1
+sudo ./controller -k 0 -p $TARGET_PID -a
+# echo "eBPF 程序已在后台运行,输出将保存到 $OUTPUT_DIR/output.log 中 请在数据收集完后 Ctrl+C。"
+read
+sudo ./controller -k 0 -p $TARGET_PID -d
+# 捕捉 Ctrl + C 信号
+# trap "echo '捕捉到 Ctrl + C 信号,停止进程...'; kill -SIGINT $PROC_IMAGE_PID; exit 0" SIGINT
+# kill -SIGINT $PROC_IMAGE_PID
+sudo ./controller -k 0 -f
+echo "eBPF 程序已在后台运行,输出将保存到`$OUTPUT_DIR/output.log` 中"
+
diff --git "a/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_keytime.sh" "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_keytime.sh"
new file mode 100755
index 000000000..0bea3f2aa
--- /dev/null
+++ "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_keytime.sh"
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+# 获取脚本所在目录的绝对路径
+SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+
+# 指定输出目录
+OUTPUT_DIR="$SCRIPT_DIR/lttng-traces/keytime_test_$(date +'%Y%m%d_%H:%M:%S')"
+CSV_FILE="$OUTPUT_DIR/keytime_test_data.csv"
+mkdir -p "$SCRIPT_DIR/ebpf/ebpf_output_$(date +'%Y%m%d_%H:%M:%S')"
+EBPF_OUTPUT_DIR="$SCRIPT_DIR/ebpf/ebpf_output_$(date +'%Y%m%d_%H:%M:%S')"
+
+# 获取目标进程的 PID
+TARGET_PID=$(pidof test_proc_image)
+
+if [ -z "$TARGET_PID" ]; then
+    echo "目标进程未运行,请先启动目标进程。"
+    exit 1
+fi
+echo "测试程序 PID: $TARGET_PID"
+
+# 创建会话并指定输出目录
+sudo lttng create xhb_keytime --output=$OUTPUT_DIR
+
+# 启用内核事件,仅针对特定 PID
+sudo lttng enable-event --kernel sched_switch,sched_process_fork,sched_process_exec,clone
+
+# 添加上下文信息
+sudo lttng add-context --kernel --type pid
+
+sudo lttng track --kernel --pid $TARGET_PID
+
+# 运行proc_image监测工具
+cd /home/xhb/lmp2/lmp/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/
+sudo ./proc_image -k > $EBPF_OUTPUT_DIR/output.log &
+PROC_IMAGE_PID=$!
+sleep 1
+sudo ./controller -k 1 -P $TARGET_PID -a
+# 启动会话
+sudo lttng start
+read
+
+sudo lttng stop 
+sudo lttng destroy
+echo "追踪数据已保存到 $OUTPUT_DIR 目录中"
+# 将 LTTng 跟踪数据转换为文本格式
+babeltrace2 $OUTPUT_DIR > $OUTPUT_DIR/trace_data.txt
+
+# 解析文本格式并导出为 CSV 文件
+echo "timestamp, event, pid, cpu, details" > $CSV_FILE
+awk '
+BEGIN {
+    FS=" "
+}
+{
+    timestamp = $1
+    event = $3
+    pid = $6
+    cpu = $8
+    details = $0
+    gsub(/,/, " ", details)  # 替换 details 中的逗号以避免 CSV 格式问题
+    printf "%s, %s, %s, %s, \"%s\"\n", timestamp, event, pid, cpu, details >> "'"$CSV_FILE"'"
+}
+' $OUTPUT_DIR/trace_data.txt
+echo "lttng、eBPF 程序数据收集完毕,请 Ctrl+C 结束"
+read
+echo "数据已导出到 $CSV_FILE"
\ No newline at end of file
diff --git "a/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_lock.sh" "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_lock.sh"
new file mode 100755
index 000000000..2a408c58a
--- /dev/null
+++ "b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/shell\350\204\232\346\234\254/test_lock.sh"
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# 获取脚本所在目录的绝对路径
+SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+
+# 指定输出目录
+OUTPUT_DIR="$SCRIPT_DIR/lttng-traces/lock_test_$(date +'%Y%m%d_%H:%M:%S')"
+CSV_FILE="$OUTPUT_DIR/lock_test_data.csv"
+mkdir -p "$SCRIPT_DIR/ebpf/ebpf_output_$(date +'%Y%m%d_%H:%M:%S')"
+EBPF_OUTPUT_DIR="$SCRIPT_DIR/ebpf/ebpf_output_$(date +'%Y%m%d_%H:%M:%S')"
+
+# 获取目标进程的 PID
+TARGET_PID=$(pidof test_proc_image)
+
+if [ -z "$TARGET_PID" ]; then
+    echo "目标进程未运行,请先启动目标进程。"
+    exit 1
+fi
+echo "测试程序 PID: $TARGET_PID"
+
+# 创建会话并指定输出目录
+sudo lttng create xhb_lock --output=$OUTPUT_DIR
+
+# 启用内核事件,仅针对特定 PID
+sudo lttng enable-event -u 'lock_monitor:*'
+
+# 添加上下文信息
+sudo lttng add-context --kernel --type pid
+
+sudo lttng track --kernel --pid $TARGET_PID
+
+# 运行proc_image监测工具
+cd /home/xhb/lmp2/lmp/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/
+sudo ./proc_image -l > $EBPF_OUTPUT_DIR/lock_output.log &
+PROC_IMAGE_PID=$!
+sleep 1
+sudo ./controller -l -P $TARGET_PID -a
+# 启动会话
+sudo lttng start
+read
+
+sudo lttng stop 
+sudo lttng view
+sudo lttng destroy
+echo "追踪数据已保存到 $OUTPUT_DIR 目录中"
+# 将 LTTng 跟踪数据转换为文本格式
+babeltrace2 $OUTPUT_DIR > $OUTPUT_DIR/trace_data.txt
+
+# 解析文本格式并导出为 CSV 文件
+echo "timestamp, event, pid, cpu, details" > $CSV_FILE
+awk '
+BEGIN {
+    FS=" "
+}
+{
+    timestamp = $1
+    event = $3
+    pid = $6
+    cpu = $8
+    details = $0
+    gsub(/,/, " ", details)  # 替换 details 中的逗号以避免 CSV 格式问题
+    printf "%s, %s, %s, %s, \"%s\"\n", timestamp, event, pid, cpu, details >> "'"$CSV_FILE"'"
+}
+' $OUTPUT_DIR/trace_data.txt
+echo "lttng、eBPF 程序数据收集完毕,请 Ctrl+C 结束"
+read
+echo "数据已导出到 $CSV_FILE"
\ No newline at end of file

From 34a6f46e3424619336ad9b0940a7b70a3e5d4fbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=99=97=E5=8D=9A?= <albert_xuu@163.com>
Date: Sat, 28 Sep 2024 16:58:32 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0lttng=E7=94=A8=E6=88=B7?=
 =?UTF-8?q?=E6=80=81=E6=8C=82=E8=BD=BD=E7=82=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../eBPF_proc_image/test/lock_tracepoint.h    | 257 ++++++++++++++++++
 .../eBPF_proc_image/test/lock_tracepoint.tp   | 241 ++++++++++++++++
 2 files changed, 498 insertions(+)
 create mode 100644 eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.h
 create mode 100644 eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.tp

diff --git a/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.h b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.h
new file mode 100644
index 000000000..60b2e438e
--- /dev/null
+++ b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.h
@@ -0,0 +1,257 @@
+
+#undef LTTNG_UST_TRACEPOINT_PROVIDER
+#define LTTNG_UST_TRACEPOINT_PROVIDER lock_monitor
+
+#undef LTTNG_UST_TRACEPOINT_INCLUDE
+#define LTTNG_UST_TRACEPOINT_INCLUDE "/home/xhb/ospp/lock_tracepoint.h"
+
+#if !defined(LOCK_TRACEPOINT_H) || defined(LTTNG_UST_TRACEPOINT_HEADER_MULTI_READ)
+#define LOCK_TRACEPOINT_H
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_lock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_lock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_lock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_trylock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_trylock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_trylock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_lock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_lock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_lock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_trylock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_trylock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_trylock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_hex(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_lock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_lock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_lock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_trylock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_trylock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_trylock_failed, TRACE_DEBUG)
+
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_failed, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_failed, TRACE_DEBUG)
+
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_lock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_lock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_lock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_trylock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_trylock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_trylock_failed, TRACE_DEBUG)
+
+
+#endif /* LOCK_TRACEPOINT_H */
+
+#include <lttng/tracepoint-event.h>
diff --git a/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.tp b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.tp
new file mode 100644
index 000000000..40363378e
--- /dev/null
+++ b/eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.tp
@@ -0,0 +1,241 @@
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_lock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_lock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_lock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_trylock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_trylock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    mutex_trylock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_rdlock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    rwlock_wrlock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_lock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_lock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_lock_released,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_trylock_start,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_trylock_acquired,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+
+TRACEPOINT_EVENT(
+    lock_monitor,
+    spinlock_trylock_failed,
+    TP_ARGS(int, thread_id, void*, lock_ptr, long long unsigned int, time),
+    TP_FIELDS(
+        ctf_integer(int, thread_id, thread_id)
+        ctf_integer_dec(void*, lock_ptr, lock_ptr)
+        ctf_integer(long long unsigned int, time, time)
+    )
+)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_lock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_lock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_lock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_trylock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_trylock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, mutex_trylock_failed, TRACE_DEBUG)
+
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_rdlock_failed, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, rwlock_wrlock_failed, TRACE_DEBUG)
+
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_lock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_lock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_lock_released, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_trylock_start, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_trylock_acquired, TRACE_DEBUG)
+TRACEPOINT_LOGLEVEL(lock_monitor, spinlock_trylock_failed, TRACE_DEBUG)
+