/usr/include/sipxtapi/utl/UtlRscTrace.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | //
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _UtlRscTrace_h_
#define _UtlRscTrace_h_
#define RSC_TEST
#undef RSC_TEST
#ifdef RSC_TEST
// SYSTEM INCLUDES
#include "utl/UtlRscStore.h"
#include <os/OsMutex.h>
// APPLICATION INCLUDES
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
//:A class used to keep track of the number of resource allocations and frees
// This class is used in conjunction with instrumented versions of the global
// new and delete operators.
class UtlRscTrace
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
static unsigned long sAllocCnt; // Track the number of memory allocs
static unsigned long sFreeCnt; // Track the number of memory frees
static int sTraceFlag;// If non-zero, print a line of info
// for every call to new()/delete()
static unsigned long sStartTime; //
static UtlRscStore mResourceStore;
enum RscType
{
NONE = 0,
MEMORY = 1,
OSSOCKET = 2,
OSMSGQ = 3,
OSBSEM = 4,
OSCSEM = 5,
OSMUTEX = 6,
OSRWMUTEX = 7,
OSTIMER = 8,
OSTASK = 9
};
/* ============================ CREATORS ================================== */
UtlRscTrace();
//:Default constructor (and take a checkpoint)
UtlRscTrace(const UtlRscTrace& rRscTrace);
//:Copy constructor
virtual
~UtlRscTrace();
//:Destructor
/* ============================ MANIPULATORS ============================== */
UtlRscTrace& operator=(const UtlRscTrace& rhs);
//:Assignment operator
virtual void checkpoint();
//:Remember the count of outstanding memory allocations
static void setTraceFlag(int flag) { sTraceFlag = flag; };
//: Set trace flag, if non-zero, print a line of info
static int enableMemTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableMsgQTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableBSemTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableCSemTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableMutexTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableRWMutexTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableTimerTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableTaskTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int enableSocketTracking(int taskId = 0);
//: Set trace flag, if non-zero, print a line of info
static int disableTracking();
//: Set trace flag, if non-zero, print a line of info
static void addAllocCnt(int addr,
int taskId);
//: Add allocCnt for the task, used for OsSocket tracking
static void addAllocCnt(int size,
int addr,
int taskId);
//: Add allocCnt for the task, used for memory/OsMutex/OsRWMutex tracking
static void addAllocCnt(int size,
int addr,
const char* name,
int pArg,
int priority,
int options,
int taskId);
//: Add allocCnt for the task, used for OsTask tracking
static void addAllocCnt(int state,
int addr,
int timerId,
int type,
int taskId);
//: Add allocCnt for the task, used for OsTimer/OsCSem tracking
static void addAllocCnt(int options,
int addr,
int state,
int taskId);
//: Add allocCnt for the task, used for OsBSem tracking
static void addAllocCnt(int addr,
const char* name,
int taskId);
//: Add allocCnt for the task, used for OsMsgQ tracking
static void addFreeCnt(int addr, int taskId = 0);
//: Add freeCnt for the task
/* ============================ ACCESSORS ================================= */
static void showMem(int taskId = 0);
static int delta();
//:Return the change to the number of outstanding memory allocations
//:since the last checkpoint.
static int delta(int taskId);
//:Return the change to the number of outstanding memory allocations
//:since the last checkpoint.
static int allocCnt(int taskId = 0);
//:Return the number of memory allocations (monotonically increasing)
static int rscStatus();
//:Return the number of memory frees (monotonically increasing)
static int freeCnt(int taskId = 0);
//:Return the number of memory frees (monotonically increasing)
static int netAllocCnt();
//:Return the net number of allocations (allocCnt - freeCnt)
static int netAllocCnt(int taskId);
//:Return the net number of allocations (allocCnt - freeCnt)
/* ============================ INQUIRY =================================== */
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
static long mCheckpoint; // Used to remember the net number of
// allocations at time of checkpoint
static OsMutex *mpResourceStoreLock;
static UtlRscStore mUtlRscStore;
static int mTaskId;
};
/* ============================ INLINE METHODS ============================ */
#endif // RSC_TEST
#endif // _UtlRscTrace_h_
|