00001 /* 00002 * Copyright (c) 2005 Palmsource, Inc. 00003 * 00004 * This software is licensed as described in the file LICENSE, which 00005 * you should have received as part of this distribution. The terms 00006 * are also available at http://www.openbinder.org/license.html. 00007 * 00008 * This software consists of voluntary contributions made by many 00009 * individuals. For the exact contribution history, see the revision 00010 * history and logs, available at http://www.openbinder.org 00011 */ 00012 00013 #ifndef _SUPPORT_P_INTRUSIVE_PROFILER_H 00014 #define _SUPPORT_P_INTRUSIVE_PROFILER_H 00015 00016 #include <PalmTypes.h> 00017 #include <sys/types.h> 00018 00019 struct DProfileTarget { 00020 nsecs_t time; 00021 uint32_t hits; 00022 char const * const target; 00023 DProfileTarget(char const * const t); 00024 ~DProfileTarget(); 00025 void Stats(void); 00026 }; 00027 00028 class DAutoProfile { 00029 nsecs_t start; 00030 DProfileTarget ⌖ 00031 public: 00032 DAutoProfile(DProfileTarget &dpt); 00033 ~DAutoProfile(); 00034 }; 00035 00036 #if !defined(INTRUSIVE_PROFILING) 00037 #define INTRUSIVE_PROFILING 0 00038 #endif 00039 00040 #if INTRUSIVE_PROFILING > 0 00041 #define DPT(x) static DProfileTarget dg_ ## x (# x) 00042 #define DAP(x) DAutoProfile _dap(dg_ ## x) 00043 #else 00044 #define DPT(x) 00045 #define DAP(x) 00046 #endif 00047 #endif