Skip to content

Commit

Permalink
Merge pull request linuxkerneltravel#920 from albertxu216/develop
Browse files Browse the repository at this point in the history
Proc_image:增加测试脚本及测试代码
  • Loading branch information
chenamy2017 authored Oct 8, 2024
2 parents af32b25 + 34a6f46 commit f0afb06
Show file tree
Hide file tree
Showing 6 changed files with 658 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -933,11 +933,6 @@ lttng监测到的结果:
通过lttng以及syscall_image的对比,可以证明我们的syscall_image工具在逻辑上是正确无误的;
其中还有很多细节没有展示,可以在以下几个原始数据中进行对比:
-
-
#### 4.2.2 数据正确性
前面我们已经对syscall-image工具进行了逻辑真确性验证,接下来我们通过对比一些数据来验证数据正确性,这些数据包括:
Expand Down Expand Up @@ -973,10 +968,6 @@ TIME TGID PID 1st/num 2nd/num 3nd/num | P_AV

通过以上数据的对比,我们可以得出结论,syscall_image在数据层面是真实可靠的,他与lttng之间存在0.0000255%的误差,是可以忽略的。

详细的原始数据可在这里查看:

-
-

### 4.3 关键数据点的关联关系

Expand Down
257 changes: 257 additions & 0 deletions eBPF_Supermarket/CPU_Subsystem/eBPF_proc_image/test/lock_tracepoint.h
Original file line number Diff line number Diff line change
@@ -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>
Loading

0 comments on commit f0afb06

Please sign in to comment.