Coverage for /Syzygy/grinder/coverage_grinder.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0030.C++source

Line-by-line coverage:

   1    :  // Copyright 2012 Google Inc.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  //
  15    :  // Declares the coverage grinder, which processes trace files containing
  16    :  // coverage data and produces LCOV output.
  17    :  #ifndef SYZYGY_GRINDER_COVERAGE_GRINDER_H_
  18    :  #define SYZYGY_GRINDER_COVERAGE_GRINDER_H_
  19    :  
  20    :  #include "syzygy/grinder/grinder.h"
  21    :  
  22    :  #include "syzygy/grinder/lcov_writer.h"
  23    :  #include "syzygy/grinder/line_info.h"
  24    :  
  25  m :  namespace grinder {
  26    :  
  27  m :  class CoverageGrinder : public GrinderInterface {
  28  m :   public:
  29  m :    typedef core::RelativeAddress RelativeAddress;
  30  m :    typedef core::AddressRange<RelativeAddress, size_t> RelativeAddressRange;
  31  m :    typedef std::vector<RelativeAddressRange> RelativeAddressRangeVector;
  32    :  
  33  m :    CoverageGrinder();
  34  m :    ~CoverageGrinder();
  35    :  
  36    :    // @name GrinderInterface implementation.
  37    :    // @{
  38  m :    virtual bool ParseCommandLine(const CommandLine* command_line) OVERRIDE;
  39  m :    virtual void SetParser(Parser* parser) OVERRIDE;
  40  m :    virtual bool Grind() OVERRIDE;
  41  m :    virtual bool OutputData(FILE* file) OVERRIDE;
  42    :    // @}
  43    :  
  44    :    // @name ParseEventHandler overrides.
  45    :    // @{
  46  m :    virtual void OnBasicBlockFrequency(
  47  m :        base::Time time,
  48  m :        DWORD process_id,
  49  m :        DWORD thread_id,
  50  m :        const TraceBasicBlockFrequencyData* data) OVERRIDE;
  51    :    // @}
  52    :  
  53  m :   protected:
  54  m :    struct PdbInfo {
  55    :      // Line and coverage information for all the source files associated with
  56    :      // a particular PDB.
  57  m :      LineInfo line_info;
  58    :      // Basic-block addresses for the module associated with a particular PDB.
  59    :      // Used to transform basic-block frequency data to line visits via
  60    :      // line_info.
  61  m :      RelativeAddressRangeVector bb_ranges;
  62  m :    };
  63    :  
  64  m :    typedef std::map<std::wstring, PdbInfo> PdbInfoMap;
  65    :  
  66    :    // Loads a new or retrieves the cached PDB info for the given PDB.
  67  m :    bool GetPdbInfo(const FilePath& pdb_path, PdbInfo** pdb_info);
  68    :  
  69    :    // Points to the parser that is feeding us events. Used to get module
  70    :    // information.
  71  m :    Parser* parser_;
  72    :    // Set to true if any call to OnBasicBlockFrequency fails. Processing will
  73    :    // continue with a warning that results may be partial.
  74  m :    bool event_handler_errored_;
  75    :    // Stores per-module coverage data, populated during calls to
  76    :    // OnBasicBlockFrequency.
  77  m :    PdbInfoMap pdb_info_map_;
  78    :    // Stores the final coverage data, populated by Grind. Contains an aggregate
  79    :    // of all LineInfo objects stored in the pdb_info_map_.
  80  m :    LcovWriter lcov_writer_;
  81  m :  };
  82    :  
  83  m :  }  // namespace grinder
  84    :  
  85    :  #endif  // SYZYGY_GRINDER_COVERAGE_GRINDER_H_

Coverage information generated Thu Sep 06 11:30:46 2012.