-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding runtime tests that ensure we can list and probe tracepoints not present in the main binary, but rather in linked shared libraries.
- Loading branch information
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifdef HAVE_SYSTEMTAP_SYS_SDT_H | ||
#include <sys/sdt.h> | ||
#else | ||
#define DTRACE_PROBE2(a, b, c, d) (void)0 | ||
#endif | ||
#include "usdt_tp.h" | ||
#include <stdio.h> | ||
#include <sys/time.h> | ||
#include <unistd.h> | ||
|
||
long myclock() | ||
{ | ||
struct timeval tv; | ||
gettimeofday(&tv, NULL); | ||
DTRACE_PROBE2(tracetestlib, lib_probe_1, tv.tv_sec, "Hello world"); | ||
DTRACE_PROBE2(tracetestlib, lib_probe_1, tv.tv_sec, "Hello world2"); | ||
DTRACE_PROBE2(tracetestlib2, lib_probe_2, tv.tv_sec, "Hello world3"); | ||
return tv.tv_sec; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#ifndef _USDTLIBX_H_ | ||
#define _USDTLIBX_H_ | ||
extern long myclock(); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "usdt_tp.h" | ||
#include <stdio.h> | ||
|
||
int main(int argc, char **argv __attribute__((unused))) | ||
{ | ||
if (argc > 1) | ||
// If we don't have Systemtap headers, we should skip USDT tests. Returning 1 | ||
// can be used as validation in the REQUIRE | ||
#ifndef HAVE_SYSTEMTAP_SYS_SDT_H | ||
return 1; | ||
#else | ||
return 0; | ||
#endif | ||
|
||
while (1) | ||
{ | ||
myclock(); | ||
} | ||
return 0; | ||
} |