xpcom/base/nsTraceRefcnt.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/base/nsTraceRefcnt.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +#ifndef nsTraceRefcnt_h___
     1.9 +#define nsTraceRefcnt_h___
    1.10 +
    1.11 +#include <stdio.h> // for FILE
    1.12 +#include "nscore.h"
    1.13 +
    1.14 +class nsTraceRefcnt
    1.15 +{
    1.16 +public:
    1.17 +  static void Startup();
    1.18 +  static void Shutdown();
    1.19 +
    1.20 +  enum StatisticsType {
    1.21 +    ALL_STATS,
    1.22 +    NEW_STATS
    1.23 +  };
    1.24 +
    1.25 +  static nsresult DumpStatistics(StatisticsType type = ALL_STATS,
    1.26 +                                        FILE* out = 0);
    1.27 +
    1.28 +  static void ResetStatistics(void);
    1.29 +
    1.30 +  static void DemangleSymbol(const char * aSymbol,
    1.31 +                                    char * aBuffer,
    1.32 +                                    int aBufLen);
    1.33 +
    1.34 +  static void WalkTheStack(FILE* aStream);
    1.35 +  /**
    1.36 +   * Tell nsTraceRefcnt whether refcounting, allocation, and destruction
    1.37 +   * activity is legal.  This is used to trigger assertions for any such
    1.38 +   * activity that occurs because of static constructors or destructors.
    1.39 +   */
    1.40 +  static void SetActivityIsLegal(bool aLegal);
    1.41 +};
    1.42 +
    1.43 +#define NS_TRACE_REFCNT_CONTRACTID "@mozilla.org/xpcom/trace-refcnt;1"
    1.44 +#define NS_TRACE_REFCNT_CID                          \
    1.45 +{ /* e3e7511e-a395-4924-94b1-d527861cded4 */         \
    1.46 +    0xe3e7511e,                                      \
    1.47 +    0xa395,                                          \
    1.48 +    0x4924,                                          \
    1.49 +    {0x94, 0xb1, 0xd5, 0x27, 0x86, 0x1c, 0xde, 0xd4} \
    1.50 +}                                                    \
    1.51 +
    1.52 +////////////////////////////////////////////////////////////////////////////////
    1.53 +// And now for that utility that you've all been asking for...
    1.54 +
    1.55 +extern "C" void
    1.56 +NS_MeanAndStdDev(double n, double sumOfValues, double sumOfSquaredValues,
    1.57 +                 double *meanResult, double *stdDevResult);
    1.58 +
    1.59 +////////////////////////////////////////////////////////////////////////////////
    1.60 +#endif

mercurial