test: trace.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# trace.c

Go to the documentation of this file.

    00001 /*++
    00002
    00003 Copyright (c) 1998  Microsoft Corporation
    00004
    00005 Module Name:
    00006
    00007     trace.c
    00008
    00009 Abstract:
    00010
    00011     This module contains the code for debug tracing.
    00012
    00013 Author:
    00014
    00015     Michael Tsang (MikeTs) 24-Sep-1998
    00016
    00017 Environment:
    00018
    00019     Kernel mode
    00020
    00021 Revision History:
    00022
    00023
    00024 --*/
    00025
    00026 #include "pch.h"
    00027
    00028 #ifdef TRACING
    00029 //
    00030 // Constants
    00031 //
    00032 #define TF_CHECKING_TRACE       0x00000001
    00033
    00034 //
    00035 // Local Data
    00036 //
    00037 int IoepTraceLevel = 0;
    00038 int IoepIndentLevel = 0;
    00039 ULONG IoepTraceFlags = 0;
    00040
    00041 BOOLEAN
    00042 IsTraceOn(
    00043     IN UCHAR   n,
    00044     IN PSZ     ProcName
    00045     )
    00046 /*++
    00047
    00048 Routine Description:
    00049     This routine determines if the given procedure should be traced.
    00050
    00051 Arguments:
    00052     n - trace level of the procedure
    00053     ProcName - points to the procedure name string
    00054
    00055 Return Value:
    00056     Success - returns TRUE
    00057     Failure - returns FALSE
    00058
    00059 --*/
    00060 {
    00061     BOOLEAN rc = FALSE;
    00062
    00063     if (!(IoepTraceFlags & TF_CHECKING_TRACE))
    00064     {
    00065         IoepTraceFlags |= TF_CHECKING_TRACE;
    00066
    00067         if (IoepTraceLevel >= n)
    00068         {
    00069             int i;
    00070
    00071             KdPrint((MODNAME ": "));
    00072
    00073             for (i = 0; i < IoepIndentLevel; ++i)
    00074             {
    00075                 KdPrint(("| "));
    00076             }
    00077
    00078             KdPrint((ProcName));
    00079
    00080             rc = TRUE;
    00081         }
    00082
    00083         IoepTraceFlags &= ~TF_CHECKING_TRACE;
    00084     }
    00085
    00086     return rc;
    00087 }       //IsTraceOn
    00088
    00089 #endif
    00090
    00091