LCOV - code coverage report
Current view: top level - toolkit/components/telemetry - CombinedStacks.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*-  Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef CombinedStacks_h__
       7             : #define CombinedStacks_h__
       8             : 
       9             : #include <vector>
      10             : 
      11             : #include "ProcessedStack.h"
      12             : 
      13             : class JSObject;
      14             : struct JSContext;
      15             : 
      16             : namespace mozilla {
      17             : namespace Telemetry {
      18             : 
      19             : /**
      20             :  * This class is conceptually a list of ProcessedStack objects, but it represents them
      21             :  * more efficiently by keeping a single global list of modules.
      22             :  */
      23           0 : class CombinedStacks {
      24             : public:
      25             :   explicit CombinedStacks();
      26             :   explicit CombinedStacks(size_t aMaxStacksCount);
      27             : 
      28             :   typedef std::vector<Telemetry::ProcessedStack::Frame> Stack;
      29             :   const Telemetry::ProcessedStack::Module& GetModule(unsigned aIndex) const;
      30             :   size_t GetModuleCount() const;
      31             :   const Stack& GetStack(unsigned aIndex) const;
      32             :   size_t AddStack(const Telemetry::ProcessedStack& aStack);
      33             :   size_t GetStackCount() const;
      34             :   size_t SizeOfExcludingThis() const;
      35             : 
      36             : #if defined(MOZ_GECKO_PROFILER)
      37             :     /** Clears the contents of vectors and resets the index. */
      38             :     void Clear();
      39             : #endif
      40             : 
      41             : private:
      42             :   std::vector<Telemetry::ProcessedStack::Module> mModules;
      43             :   // A circular buffer to hold the stacks.
      44             :   std::vector<Stack> mStacks;
      45             :   // The index of the next buffer element to write to in mStacks.
      46             :   size_t mNextIndex;
      47             :   // The maximum number of stacks to keep in the CombinedStacks object.
      48             :   size_t mMaxStacksCount;
      49             : };
      50             : 
      51             : /**
      52             :  * Creates a JSON representation of given combined stacks object.
      53             :  */
      54             : JSObject *
      55             : CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks);
      56             : 
      57             : } // namespace Telemetry
      58             : } // namespace mozilla
      59             : 
      60             : #endif // CombinedStacks_h__

Generated by: LCOV version 1.13