akaros/user/perfmon/pfmlib_intel_ivb.c
<<
>>
Prefs
   1/*
   2 * pfmlib_intel_ivb.c : Intel Ivy Bridge core PMU
   3 *
   4 * Copyright (c) 2012 Google, Inc
   5 * Contributed by Stephane Eranian <eranian@gmail.com>
   6 *
   7 * Permission is hereby granted, free of charge, to any person obtaining a copy
   8 * of this software and associated documentation files (the "Software"), to deal
   9 * in the Software without restriction, including without limitation the rights
  10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  11 * of the Software, and to permit persons to whom the Software is furnished to do so,
  12 * subject to the following conditions:
  13 *
  14 * The above copyright notice and this permission notice shall be included in all
  15 * copies or substantial portions of the Software.
  16 *
  17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  18 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  19 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
  21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23 */
  24/* private headers */
  25#include "pfmlib_priv.h"
  26#include "pfmlib_intel_x86_priv.h"
  27#include "events/intel_ivb_events.h"
  28
  29static int
  30pfm_ivb_init(void *this)
  31{
  32        pfm_intel_x86_cfg.arch_version = 3;
  33        return PFM_SUCCESS;
  34}
  35
  36static const int ivb_models[] = {
  37        58, /* IvyBridge (Core i3/i5/i7 3xxx) */
  38        0
  39};
  40
  41static const int ivbep_models[] = {
  42        62, /* Ivytown */
  43        0
  44};
  45
  46pfmlib_pmu_t intel_ivb_support={
  47        .desc                   = "Intel Ivy Bridge",
  48        .name                   = "ivb",
  49        .pmu                    = PFM_PMU_INTEL_IVB,
  50        .pme_count              = LIBPFM_ARRAY_SIZE(intel_ivb_pe),
  51        .type                   = PFM_PMU_TYPE_CORE,
  52        .supported_plm          = INTEL_X86_PLM,
  53        .num_cntrs              = 8, /* consider with HT off by default */
  54        .num_fixed_cntrs        = 3,
  55        .max_encoding           = 2, /* offcore_response */
  56        .pe                     = intel_ivb_pe,
  57        .atdesc                 = intel_x86_mods,
  58        .flags                  = PFMLIB_PMU_FL_RAW_UMASK
  59                                | INTEL_X86_PMU_FL_ECMASK,
  60        .cpu_family             = 6,
  61        .cpu_models             = ivb_models,
  62        .pmu_detect             = pfm_intel_x86_model_detect,
  63        .pmu_init               = pfm_ivb_init,
  64        .get_event_encoding[PFM_OS_NONE] = pfm_intel_x86_get_encoding,
  65         PFMLIB_ENCODE_PERF(pfm_intel_x86_get_perf_encoding),
  66        .get_event_first        = pfm_intel_x86_get_event_first,
  67        .get_event_next         = pfm_intel_x86_get_event_next,
  68        .event_is_valid         = pfm_intel_x86_event_is_valid,
  69        .validate_table         = pfm_intel_x86_validate_table,
  70        .get_event_info         = pfm_intel_x86_get_event_info,
  71        .get_event_attr_info    = pfm_intel_x86_get_event_attr_info,
  72         PFMLIB_VALID_PERF_PATTRS(pfm_intel_x86_perf_validate_pattrs),
  73        .get_event_nattrs       = pfm_intel_x86_get_event_nattrs,
  74        .can_auto_encode        = pfm_intel_x86_can_auto_encode,
  75};
  76
  77pfmlib_pmu_t intel_ivb_ep_support={
  78        .desc                   = "Intel Ivy Bridge EP",
  79        .name                   = "ivb_ep",
  80        .pmu                    = PFM_PMU_INTEL_IVB_EP,
  81        .pme_count              = LIBPFM_ARRAY_SIZE(intel_ivb_pe),
  82        .type                   = PFM_PMU_TYPE_CORE,
  83        .supported_plm          = INTEL_X86_PLM,
  84        .num_cntrs              = 8, /* consider with HT off by default */
  85        .num_fixed_cntrs        = 3,
  86        .max_encoding           = 2, /* offcore_response */
  87        .pe                     = intel_ivb_pe,
  88        .atdesc                 = intel_x86_mods,
  89        .flags                  = PFMLIB_PMU_FL_RAW_UMASK
  90                                | INTEL_X86_PMU_FL_ECMASK,
  91        .cpu_family             = 6,
  92        .cpu_models             = ivbep_models,
  93        .pmu_detect             = pfm_intel_x86_model_detect,
  94        .pmu_init               = pfm_ivb_init,
  95        .get_event_encoding[PFM_OS_NONE] = pfm_intel_x86_get_encoding,
  96         PFMLIB_ENCODE_PERF(pfm_intel_x86_get_perf_encoding),
  97        .get_event_first        = pfm_intel_x86_get_event_first,
  98        .get_event_next         = pfm_intel_x86_get_event_next,
  99        .event_is_valid         = pfm_intel_x86_event_is_valid,
 100        .validate_table         = pfm_intel_x86_validate_table,
 101        .get_event_info         = pfm_intel_x86_get_event_info,
 102        .get_event_attr_info    = pfm_intel_x86_get_event_attr_info,
 103         PFMLIB_VALID_PERF_PATTRS(pfm_intel_x86_perf_validate_pattrs),
 104        .get_event_nattrs       = pfm_intel_x86_get_event_nattrs,
 105        .can_auto_encode        = pfm_intel_x86_can_auto_encode,
 106};
 107