michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsTraceRefcnt_h___ michael@0: #define nsTraceRefcnt_h___ michael@0: michael@0: #include // for FILE michael@0: #include "nscore.h" michael@0: michael@0: class nsTraceRefcnt michael@0: { michael@0: public: michael@0: static void Startup(); michael@0: static void Shutdown(); michael@0: michael@0: enum StatisticsType { michael@0: ALL_STATS, michael@0: NEW_STATS michael@0: }; michael@0: michael@0: static nsresult DumpStatistics(StatisticsType type = ALL_STATS, michael@0: FILE* out = 0); michael@0: michael@0: static void ResetStatistics(void); michael@0: michael@0: static void DemangleSymbol(const char * aSymbol, michael@0: char * aBuffer, michael@0: int aBufLen); michael@0: michael@0: static void WalkTheStack(FILE* aStream); michael@0: /** michael@0: * Tell nsTraceRefcnt whether refcounting, allocation, and destruction michael@0: * activity is legal. This is used to trigger assertions for any such michael@0: * activity that occurs because of static constructors or destructors. michael@0: */ michael@0: static void SetActivityIsLegal(bool aLegal); michael@0: }; michael@0: michael@0: #define NS_TRACE_REFCNT_CONTRACTID "@mozilla.org/xpcom/trace-refcnt;1" michael@0: #define NS_TRACE_REFCNT_CID \ michael@0: { /* e3e7511e-a395-4924-94b1-d527861cded4 */ \ michael@0: 0xe3e7511e, \ michael@0: 0xa395, \ michael@0: 0x4924, \ michael@0: {0x94, 0xb1, 0xd5, 0x27, 0x86, 0x1c, 0xde, 0xd4} \ michael@0: } \ michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: // And now for that utility that you've all been asking for... michael@0: michael@0: extern "C" void michael@0: NS_MeanAndStdDev(double n, double sumOfValues, double sumOfSquaredValues, michael@0: double *meanResult, double *stdDevResult); michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: #endif