1 /* 2 * Header file of Pure API function declarations. 3 * 4 * (C) Copyright IBM Corporation. 2006, 2006. All Rights Reserved. 5 * You may recompile and redistribute these definitions as required. 6 * 7 * Version 1.0 8 */ 9 10 #if defined(PURIFY) || defined(QUANTIFY) 11 12 #if defined(c_plusplus) || defined(__cplusplus) 13 extern "C" { 14 #endif 15 16 // Don't include this file directly, use purify.h instead. 17 // If you need something that's not there, add it. 18 #ifdef PURIFY_PRIVATE_INCLUDE 19 20 #define PURE_H_VERSION 1 21 #include <stddef.h> 22 23 ////////////////////////////// 24 // API's Specific to Purify // 25 ////////////////////////////// 26 27 // TRUE when Purify is running. 28 int __cdecl PurifyIsRunning(void) ; 29 // 30 // Print a string to the viewer. 31 // 32 int __cdecl PurePrintf(const char *fmt, ...) ; 33 int __cdecl PurifyPrintf(const char *fmt, ...) ; 34 // 35 // Purify functions for leak and memory-in-use functionalty. 36 // 37 size_t __cdecl PurifyNewInuse(void) ; 38 size_t __cdecl PurifyAllInuse(void) ; 39 size_t __cdecl PurifyClearInuse(void) ; 40 size_t __cdecl PurifyNewLeaks(void) ; 41 size_t __cdecl PurifyAllLeaks(void) ; 42 size_t __cdecl PurifyClearLeaks(void) ; 43 // 44 // Purify functions for handle leakage. 45 // 46 size_t __cdecl PurifyAllHandlesInuse(void) ; 47 size_t __cdecl PurifyNewHandlesInuse(void) ; 48 // 49 // Functions that tell you about the state of memory. 50 // 51 size_t __cdecl PurifyDescribe(void *addr) ; 52 size_t __cdecl PurifyWhatColors(void *addr, size_t size) ; 53 // 54 // Functions to test the state of memory. If the memory is not 55 // accessable, an error is signaled just as if there were a memory 56 // reference and the function returns false. 57 // 58 int __cdecl PurifyAssertIsReadable(const void *addr, size_t size) ; // size used to be an int, until IA64 came along 59 int __cdecl PurifyAssertIsWritable(const void *addr, size_t size) ; 60 // 61 // Functions to test the state of memory. If the memory is not 62 // accessable, these functions return false. No error is signaled. 63 // 64 int __cdecl PurifyIsReadable(const void *addr, size_t size) ; 65 int __cdecl PurifyIsWritable(const void *addr, size_t size) ; 66 int __cdecl PurifyIsInitialized(const void *addr, size_t size) ; 67 // 68 // Functions to set the state of memory. 69 // 70 void __cdecl PurifyMarkAsInitialized(void *addr, size_t size) ; 71 void __cdecl PurifyMarkAsUninitialized(void *addr, size_t size) ; 72 // 73 // Functions to do late detection of ABWs, FMWs, IPWs. 74 // 75 #define PURIFY_HEAP_CRT (HANDLE) ~(__int64) 1 /* 0xfffffffe */ 76 #define PURIFY_HEAP_ALL (HANDLE) ~(__int64) 2 /* 0xfffffffd */ 77 #define PURIFY_HEAP_BLOCKS_LIVE 0x80000000 78 #define PURIFY_HEAP_BLOCKS_DEFERRED_FREE 0x40000000 79 #define PURIFY_HEAP_BLOCKS_ALL (PURIFY_HEAP_BLOCKS_LIVE|PURIFY_HEAP_BLOCKS_DEFERRED_FREE) 80 int __cdecl PurifyHeapValidate(unsigned int hHeap, unsigned int dwFlags, const void *addr) ; 81 int __cdecl PurifySetLateDetectScanCounter(int counter); 82 int __cdecl PurifySetLateDetectScanInterval(int seconds); 83 // 84 // Functions to support pool allocators 85 // 86 void __cdecl PurifySetPoolId(const void *mem, int id); 87 int __cdecl PurifyGetPoolId(const void *mem); 88 void __cdecl PurifySetUserData(const void *mem, void *data); 89 void * __cdecl PurifyGetUserData(const void *mem); 90 void __cdecl PurifyMapPool(int id, void(*fn)()); 91 92 93 //////////////////////////////// 94 // API's Specific to Quantify // 95 //////////////////////////////// 96 97 // TRUE when Quantify is running. 98 int __cdecl QuantifyIsRunning(void) ; 99 100 // 101 // Functions for controlling collection 102 // 103 int __cdecl QuantifyDisableRecordingData(void) ; 104 int __cdecl QuantifyStartRecordingData(void) ; 105 int __cdecl QuantifyStopRecordingData(void) ; 106 int __cdecl QuantifyClearData(void) ; 107 int __cdecl QuantifyIsRecordingData(void) ; 108 109 // Add a comment to the dataset 110 int __cdecl QuantifyAddAnnotation(char *) ; 111 112 // Save the current data, creating a "checkpoint" dataset 113 int __cdecl QuantifySaveData(void) ; 114 115 // Set the name of the current thread in the viewer 116 int __cdecl QuantifySetThreadName(char *) ; 117 118 //////////////////////////////// 119 // API's Specific to Coverage // 120 //////////////////////////////// 121 122 // TRUE when Coverage is running. 123 int __cdecl CoverageIsRunning(void) ; 124 // 125 // Functions for controlling collection 126 // 127 int __cdecl CoverageDisableRecordingData(void) ; 128 int __cdecl CoverageStartRecordingData(void) ; 129 int __cdecl CoverageStopRecordingData(void) ; 130 int __cdecl CoverageClearData(void) ; 131 int __cdecl CoverageIsRecordingData(void) ; 132 // Add a comment to the dataset 133 int __cdecl CoverageAddAnnotation(char *) ; 134 135 // Save the current data, creating a "checkpoint" dataset 136 int __cdecl CoverageSaveData(void) ; 137 138 139 #endif // PURIFY_PRIVATE_INCLUDE 140 141 #if defined(c_plusplus) || defined(__cplusplus) 142 } 143 #endif 144 145 #endif // defined(PURIFY) || defined(QUANTIFY)