aboutsummaryrefslogblamecommitdiffstats
path: root/lib/dtrace/examples/efile_drv.systemtap
blob: 5a47b3e22b4f72f41e6819e5c022aac3eed7c3b0 (plain) (tree)















































































































                                                                                          
/*
 * %CopyrightBegin%
 *
 * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011. All Rights Reserved.
 *
 * The contents of this file are subject to the Erlang Public License,
 * Version 1.1, (the "License"); you may not use this file except in
 * compliance with the License. You should have received a copy of the
 * Erlang Public License along with this software. If not, it can be
 * retrieved online at http://www.erlang.org/.
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights 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;