aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime_tools/examples/efile_drv.systemtap
blob: 12bd7a14a365f4aea1363268c69743e49df369bd (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * %CopyrightBegin%
 *
 * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * %CopyrightEnd%
 */
/*
 * Note: This file assumes that you're using the non-SMP-enabled Erlang
 *       virtual machine, "beam".  The SMP-enabled VM is called "beam.smp".
 *       Note that other variations of the virtual machine also have
 *       different names, e.g. the debug build of the SMP-enabled VM
 *       is "beam.debug.smp".
 *
 *       To use a different virtual machine, replace each instance of
 *       "beam" with "beam.smp" or the VM name appropriate to your
 *       environment.
 */

probe begin
{
    op_map[1] = "OPEN";
    op_map[2] = "READ";
    op_map[3] = "LSEEK";
    op_map[4] = "WRITE";
    op_map[5] = "FSTAT";
    op_map[6] = "PWD";
    op_map[7] = "READDIR";
    op_map[8] = "CHDIR";
    op_map[9] = "FSYNC";
    op_map[10] = "MKDIR";
    op_map[11] = "DELETE";
    op_map[12] = "RENAME";
    op_map[13] = "RMDIR";
    op_map[14] = "TRUNCATE";
    op_map[15] = "READ_FILE";
    op_map[16] = "WRITE_INFO";
    op_map[19] = "LSTAT";
    op_map[20] = "READLINK";
    op_map[21] = "LINK";
    op_map[22] = "SYMLINK";
    op_map[23] = "CLOSE";
    op_map[24] = "PWRITEV";
    op_map[25] = "PREADV";
    op_map[26] = "SETOPT";
    op_map[27] = "IPREAD";
    op_map[28] = "ALTNAME";
    op_map[29] = "READ_LINE";
    op_map[30] = "FDATASYNC";
    op_map[31] = "FADVISE";
}

probe process("beam").mark("aio_pool-add")
{
    printf("async I/O pool port %s queue len %d\n", user_string($arg1), $arg2);
}

probe process("beam").mark("aio_pool-get")
{
    printf("async I/O pool port %s queue len %d\n", user_string($arg1), $arg2);
}

probe process("beam").mark("efile_drv-entry")
{
    printf("efile_drv enter tag={%d,%d} %s%s | %s (%d) | args: %s %s , %d %d (port %s)\n",
	   $arg1, $arg2,
           $arg3 == NULL ? "" : "user tag ",
           $arg3 == NULL ? "" : user_string($arg3),
           op_map[$arg4], $arg4,
	   $arg5 == NULL ? "" : user_string($arg5),
	   $arg6 == NULL ? "" : user_string($arg6), $arg7, $arg8,
           /* NOTE: port name in $arg[11] is experimental */
           user_string($arg11))
}

probe process("beam").mark("efile_drv-int*")
{
    printf("async I/O worker tag={%d,%d} | %s (%d) | %s\n",
           $arg1, $arg2, op_map[$arg3], $arg3, probefunc());
}

probe process("beam").mark("efile_drv-return")
{
    if ($arg5 == 0) {
       /* efile_drv-return error case */
       printf("efile_drv return tag={%d,%d} %s%s | %s (%d) | errno %d\n",
           $arg1, $arg2,
           $arg3 == NULL ? "" : "user tag ",
           $arg3 == NULL ? "" : user_string($arg3),
           op_map[$arg4], $arg4,
           $arg6);
    } else {
       /* efile_drv-return success case */
       printf("efile_drv return tag={%d,%d} %s | %s (%d) ok\n",
           $arg1, $arg2,
           $arg3 == NULL ? "" : user_string($arg3),
           op_map[$arg4], $arg4);
    }
}

global op_map;