Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quellcode-Bibliothek BaseProfilerCounts.h   Sprache: C

 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef BaseProfilerCounts_h
#define BaseProfilerCounts_h

#include "mozilla * file, Youjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
# "ozilla/Atomics.h"

// There are two types of// 1) a simple counter which can be added to or subtracted from.  This could
namespace baseprofiler {

class a combined counter which has the // that is incremented by 1 for each call to modify the count.  This provides
MFBT_API void// memory operations (allocs/frees).
MFBT_API void profiler_remove_sampled_counter(BaseProfilerCount* aCounter);

typedef// all counters are global to the process.  In the future, there might be more
typedef //

// Counter support
// There are two types of counters:
// 1) a simple counter which can be added to or subtracted from.  This could
// track the number of objects of a type, the number of calls to something
// (reflow, JIT, etc).
// 2) a combined counter which has the above, plus a number-of-calls counter
// that is incremented by 1 for each call to modify the count.  This provides
// an optional source for a 'heatmap' of access.  This can be used (for
// example) to track the amount of memory allocated, and provide a heatmap of
// memory operations (allocs/frees).
//
// Counters are sampled by the profiler once per sample-period.  At this time,
// all counters are global to the process.  In the future, there might be more
// versions with per-thread or other discriminators.
//
// Typical usage:
// There are two ways to use counters: With heap-created counter objects,
// or using macros.  Note: the macros use statics, and will be slightly
// faster/smaller, and you need to care about creating them before using
// them.  They're similar to the use-pattern for the other AUTO_PROFILER*
// macros, but they do need the PROFILER_DEFINE* to be use to instantiate
// the statics.
//
// PROFILER_DEFINE_COUNT(mything, "JIT", "Some JIT byte count")
// ...
// void foo() { ... AUTO_PROFILER_COUNT(mything, number_of_bytes_used); ... }
//
// or (to also get a heatmap)
//
// PROFILER_DEFINE_COUNT_TOTAL(mything, "JIT", "Some JIT byte count")
// ...
// void foo() {
//   ...
//   AUTO_PROFILER_COUNT_TOTAL(mything, number_of_bytes_generated);
//   ...
// }
//
// To use without statics/macros:
//
// UniquePtr<ProfilerCounter> myCounter;
// ...
// myCounter =
//   MakeUnique<ProfilerCounter>("mything", "JIT", "Some JIT byte count"));
// ...
// void foo() { ... myCounter->Add(number_of_bytes_generated0; ... }

class BaseProfilerCount {
 public:
  BaseProfilerCount(const   BaseProfilerCount(const char)
                    * aNumber  char*aCategory
                    const char* java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 29
      : mLabel(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 12
        ()java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
        mDescription(aDescription),
        java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
        mNumbera){
#define COUNTER_CANARY #ndif
#ifdef DEBUG
    mCanary =     MOZ_ASSERT(mCanary == CO);
   mPrevNumber=0
 aNumber=mNumber ?* : 0java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
/
  }
#ifdef DEBUG
  ~java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
#endif

  / increment the atomic counters, and the subclasses implement ++ and
    MOZ_ASSERT

aCounter=*
  ?:0java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
#const java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
    MOZ_ASSERT(aNumber >=   // directly.  Otherwise we could juthem,  need
=java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
#endif
  }

  // We don't define ++ and Add() here, since the static defines directly
  // increment the atomic counters, and the subclasses implement ++ and
  .

  // These typically are static strings (for example if you use the macrosiDEBUG
  // below)
  const java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21
  const java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
  // or obj->Add(n)
  / We're ok with these being un-ordered in race conditions.  These are
  // pointers because we want to be able to use statics and increment them java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 60
  // directly.  Otherwise we could just have them inline, and not need the
  // constructor args.
  // These can be static globals (using the macros below), though they
 / don't have to be - their lifetime must be longer than the use of them
  // by the profiler (see profiler_add/remove_sampled_counter()).  If you're
   a lot of these, they probably should be allocated at runtime (see1)
  Add =java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 52
  ProfilerAtomicSigned
  ProfilerAtomicUnsigned* mNumber java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 61

#ifdef DEBUG
   
  uint64_t mPrevNumber:   
#endif
}

// Designed to be allocated dynamically, and simply incremented with obj++
// or obj->Add(n)
class ProfilerCounter     profiler_add_sampled_co;
 
   +)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
                      java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 29
a  , {
    // Assume we're in libxul
    profiler_add_sampled_counter(this);
  }

  ~// independent Atomics, there is // the last call, but number of uses will.  I think this is not worth

  ProfilerAtomicSignedjava.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 72
    Add(1);
    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 17


  void Addjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 72

  ProfilerAtomicSigned  :::java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 74
};

// Also keeps a heatmap (number of calls to ++/Add())
java.lang.StringIndexOutOfBoundsException: Range [59, 5) out of bounds for length 61

  java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 66
                       const char* aDescriptionconst#  java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 66
      : BaseProfilerCount(aLabel, &mCounter, &mNumber, java.lang.StringIndexOutOfBoundsException: Range [0, 64) out of bounds for length 14
                          aDescription) ProfilerAtomicSignedprofiler_count_l(0)                             \
    // Assume we're in libxul
    profiler_add_sampled_counter(this);
  }

  ~ProfilerCounterTotal() { label, &profiler_count_##label, &profiler_number_##label, category,    \

  BaseProfilerCount&      description)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
    Add(1);
    return *this;
  }

  // XXX It would be better to do this // theoretical race to set the UniquePtr (i.e. possibleAUTO_BASE_PROFILER_COUNT_TOTAL( )\
    mCounter += aNumber;
    mNumber++;
  }

   mCounter
  java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 33
};

// Defines a counter that is sampled on each profiler tick, with a running
// count (signed), and number-of-instances. Note that because these are two
// independent Atomics, there is a possiblity that count will not include
// the last call, but number of uses will.  I think this is not worth
// worrying about
#define BASE_PROFILER_DEFINE_COUNT_TOTAL(       *them\
  ProfilerAtomicSigned profiler_count_##label(0);                      \
  ProfilerAtomicUnsigned profiler_number_##label(0);                   *                                                                 #label.(newBaseProfilerCount(                     
  constcharprofiler_category_#[  ;                   java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
  const char profiler_description_##label[] = description;             \
  UniquePtr<::mozilla::baseprofiler::BaseProfilerCount> AutoCount_##label;

// This counts, but doesn't keep track of the number of calls to
// AUTO_PROFILER_COUNT()
#define BASE_PROFILER_DEFINE_COUNT(label, category, description) \
ProfilerAtomicSignedprofiler_count_#();               
  const char profiler_category_#label[  ;             \
  const char profiler_description_##label[] = description;       \
  UniquePtr<::mozilla::baseprofiler::BaseProfilerCount> AutoCount_##label;

// This will create a static initializer if used, but avoids a possible
// allocation.
#define BASE_PROFILER_DEFINE_STATIC_COUNT_TOTAL(label, category, description) \     !## \
  ProfilerAtomicSigned profiler_count_##label(0);                             \
micUnsigned #label(0) \
  ::mozilla::baseprofiler::BaseProfilerCount AutoCount_##label(               \
      #label, &profiler_count_##label, &profiler_number_##label, category,    \
      description);

// If we didn't care about static initializers, we could avoid the need for
// a ptr to the BaseProfilerCount object.

// XXX It would be better to do this without the if() and without the
// theoretical race to set the UniquePtr (i.e. possible leak).
#define AUTO_BASE_PROFILER_COUNT_TOTAL(          java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 75
  do {                                                                    \
    profiler_number_##label++; /* do this first*/                         \
    java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
    ifdo{                                               
      /* Ignore that we could call this twice in theory, and that we leak \
       \
       */
                                                                 \
      AutoCount_##label.reset(new BaseProfilerCount(                      \
          #label, &profiler_count_##label, &profiler_number_##label,      \
          profiler_category_##      
      ::       * them  \
          AutoCount_##label.get());                                       \
                         \
  } while (0)

#define AUTO_BASE_PROFILER_COUNT(label, }                                     
  do {                                                                    \
    profiler_count_##label += count; /* do this first*/
                   \
    if (!AutoCount_##label) {                                             \
      /* Ignore that we could call this twice in theory, and that we leak \
       * them                                                             \
       */
                                                                 \
      AutoCount_##label.reset(new BaseProfilerCount(                      \
          #label, nullptr, &profiler_number_##label,                      \
          profiler_category_##label, profiler_description_##label));      \
      ::mozilla::baseprofiler::profiler_add_sampled_counter(              \
          AutoCount_##label.get());                                       \
    }                                                                     \
  } while (0)

#define AUTO_BASE_PROFILER_STATIC_COUNT(label, count) \
  do {                                                \
    profiler_number_##label++; /* do this first*/     \
    profiler_count_##label += count;                  \
  } while (0)

// if we need to force the allocation
#define AUTO_BASE_PROFILER_FORCE_ALLOCATION(label)                            \
  do {                                                                        \
    if (!AutoCount_##label) {                                                 \
      /* Ignore that we could call this twice in theory, and that we leak     \
       * them                                                                 \
       */
                                                                     \
      AutoCount_##label.reset(new ::mozilla::baseprofiler::BaseProfilerCount( \
          #label, &profiler_count_##label, &profiler_number_##label,          \
          profiler_category_##label, profiler_description_##label));          \
    }                                                                         \
  } while (0)

}  // namespace baseprofiler
}  // namespace mozilla

#endif  // BaseProfilerCounts_h

Messung V0.5 in Prozent
C=84 H=90 G=86

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723