Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / onlineupdate / source / update / inc / mozilla / nsTraceRefcnt.h
blobc5b1de7e806a3665796038dd2a904c2d5632a2e4
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsTraceRefcnt_h___
7 #define nsTraceRefcnt_h___
9 #include <stdio.h> // for FILE
10 #include "nscore.h"
12 class nsTraceRefcnt
14 public:
15 static void Shutdown();
17 enum StatisticsType {
18 ALL_STATS,
19 NEW_STATS
22 static nsresult DumpStatistics(StatisticsType aType = ALL_STATS,
23 FILE* aOut = 0);
25 static void ResetStatistics();
27 static void DemangleSymbol(const char* aSymbol, char* aBuffer, int aBufLen);
29 static void WalkTheStack(FILE* aStream);
31 /**
32 * This is a variant of |WalkTheStack| that uses |CodeAddressService| to cache
33 * the results of |NS_DescribeCodeAddress|. If |WalkTheStackCached| is being
34 * called frequently, it will be a few orders of magnitude faster than
35 * |WalkTheStack|. However, the cache uses a lot of memory, which can cause
36 * OOM crashes. Therefore, this should only be used for things like refcount
37 * logging which walk the stack extremely frequently.
39 static void WalkTheStackCached(FILE* aStream);
41 /**
42 * Tell nsTraceRefcnt whether refcounting, allocation, and destruction
43 * activity is legal. This is used to trigger assertions for any such
44 * activity that occurs because of static constructors or destructors.
46 static void SetActivityIsLegal(bool aLegal);
49 #define NS_TRACE_REFCNT_CONTRACTID "@mozilla.org/xpcom/trace-refcnt;1"
50 #define NS_TRACE_REFCNT_CID \
51 { /* e3e7511e-a395-4924-94b1-d527861cded4 */ \
52 0xe3e7511e, \
53 0xa395, \
54 0x4924, \
55 {0x94, 0xb1, 0xd5, 0x27, 0x86, 0x1c, 0xde, 0xd4} \
56 } \
58 ////////////////////////////////////////////////////////////////////////////////
59 // And now for that utility that you've all been asking for...
61 extern "C" void
62 NS_MeanAndStdDev(double aNumberOfValues,
63 double aSumOfValues, double aSumOfSquaredValues,
64 double* aMeanResult, double* aStdDevResult);
66 ////////////////////////////////////////////////////////////////////////////////
67 #endif