-
Notifications
You must be signed in to change notification settings - Fork 2
/
fftrace.c
44 lines (39 loc) · 864 Bytes
/
fftrace.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "fftrace.h"
int trace_fd = -1;
int marker_fd = -1;
char *debugfs = "/sys/kernel/debug";
int ff_trace_on()
{
char path[256];
strcpy(path, debugfs);
strcat(path, "/tracing/tracing_on");
trace_fd = open(path, O_WRONLY);
if (trace_fd >= 0)
write(trace_fd, "1", 1);
strcpy(path, debugfs);
strcat(path,"/tracing/trace_marker");
marker_fd = open(path, O_WRONLY);
if (marker_fd >= 0)
write(marker_fd, "In critical area\n", 17);
return 0;
}
int ff_trace_off()
{
if (marker_fd >= 0)
write(marker_fd, "Out critical area\n", 17);
if (trace_fd >= 0)
write(trace_fd, "0", 1);
close(marker_fd);
close(trace_fd);
trace_fd = -1;
marker_fd = -1;
return 0;
}
int main()
{
ff_trace_on();
ff_trace_off();
}