Coverage for /Syzygy/common/indexed_frequency_data.h

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

Line-by-line coverage:

   1    :  // Copyright 2013 Google Inc. All Rights Reserved.
   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 data structure that will be used by various pieces of the
  16    :  // instrumentation and trace agent's to collect data at runtime.
  17    :  
  18    :  #ifndef SYZYGY_COMMON_INDEXED_FREQUENCY_DATA_H_
  19    :  #define SYZYGY_COMMON_INDEXED_FREQUENCY_DATA_H_
  20    :  
  21    :  #include <windows.h>
  22    :  
  23    :  #include "base/basictypes.h"
  24    :  
  25  m :  namespace common {
  26    :  
  27    :  #pragma pack(push, 1)
  28    :  
  29    :  // This data structure is injected into an instrumented image in a read-write
  30    :  // section of its own. It will be initialized by the runtime client library
  31    :  // and is referred to by all of the instrumentation code.
  32  m :  struct IndexedFrequencyData {
  33    :    // An identifier denoting the agent with which this frequency data
  34    :    // instrumentation is intended to work.
  35  m :    uint32 agent_id;
  36    :  
  37    :    // The version of the data structure and agent of the toolchain that
  38    :    // instrumented the binary. If this doesn't match the running client
  39    :    // library then the whole process should be aborted. This just a simple
  40    :    // counter which should be updated whenever a non-backwards compatible
  41    :    // change is made to the data structure or its usage.
  42  m :    uint32 version;
  43    :  
  44    :    // The TLS slot associated with this module (if any). This allows for the
  45    :    // frequency trace data to be managed on a per-thread basis, if desired by the
  46    :    // agent.
  47  m :    DWORD tls_index;
  48    :  
  49    :    // This points to an array of length 'num_entries' counter elements. At
  50    :    // link time it is initialized to point to statically allocated array that is
  51    :    // in the .data section of the image (this is done so that if capture is not
  52    :    // enabled the binary can still run without crashing). If a single process-
  53    :    // wide frequency table is needed, the agent may allocate a call-trace buffer
  54    :    // and redirect this pointer to point into it. Alternatively, it may allocate
  55    :    // any thread-specific context it requires and refer to this pointer as a
  56    :    // fall-back measure if tracing is disabled.
  57    :    //
  58    :    // The total size (in bytes) of the buffer pointed to by is
  59    :    // num_entries * frequency_size.
  60  m :    void* frequency_data;
  61    :  
  62    :    // The number of entries in the frequency table. This is required by the
  63    :    // runtime client library so it knows how big an array to allocate.
  64  m :    uint32 num_entries;
  65    :  
  66    :    // The number of bytes used for each element of frequency_data: 1, 4, or 8.
  67  m :    uint8 frequency_size;
  68    :  
  69    :    // Each module only needs to be registered once with the call-trace service.
  70    :    // Our hooks grab various entry points (e.g. TLS initializers and the image
  71    :    // entry points), so the initialization routine may be called repeatedly. We
  72    :    // use this to determine whether or not we should try initializing things.
  73    :    // Upon first entry this is protected by the loader lock and afterwards it
  74    :    // is only read, so synchronization is not an issue.
  75  m :    uint8 initialization_attempted;
  76  m :  };
  77    :  
  78    :  #pragma pack(pop)
  79    :  
  80  m :  }  // namespace common
  81    :  
  82    :  #endif  // SYZYGY_COMMON_INDEXED_FREQUENCY_DATA_H_

Coverage information generated Thu Mar 14 11:53:36 2013.