akaros/user/perfmon/pfmlib_intel_slm.c
<<
>>
Prefs
   1/*
   2 * pfmlib_intel_slm.c : Intel Silvermont core PMU
   3 *
   4 * Copyright (c) 2013 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 * Based on Intel Software Optimization Guide June 2013
  25 */
  26
  27/* private headers */
  28#include "pfmlib_priv.h"
  29#include "pfmlib_intel_x86_priv.h"
  30#include "events/intel_slm_events.h"
  31
  32static const int slm_models[] = {
  33        55, /* Silvermont */
  34        77, /* Silvermont Avoton */
  35        0
  36};
  37
  38static int
  39pfm_intel_slm_init(void *this)
  40{
  41        pfm_intel_x86_cfg.arch_version = 2;
  42        return PFM_SUCCESS;
  43}
  44
  45pfmlib_pmu_t intel_slm_support={
  46        .desc                   = "Intel Silvermont",
  47        .name                   = "slm",
  48        .pmu                    = PFM_PMU_INTEL_SLM,
  49        .pme_count              = LIBPFM_ARRAY_SIZE(intel_slm_pe),
  50        .type                   = PFM_PMU_TYPE_CORE,
  51        .num_cntrs              = 4,
  52        .num_fixed_cntrs        = 3,
  53        .max_encoding           = 2,
  54        .pe                     = intel_slm_pe,
  55        .atdesc                 = intel_x86_mods,
  56        .flags                  = PFMLIB_PMU_FL_RAW_UMASK
  57                                | INTEL_X86_PMU_FL_ECMASK,
  58        .supported_plm          = INTEL_X86_PLM,
  59
  60        .cpu_family             = 6,
  61        .cpu_models             = slm_models,
  62        .pmu_detect             = pfm_intel_x86_model_detect,
  63        .pmu_init               = pfm_intel_slm_init,
  64
  65        .get_event_encoding[PFM_OS_NONE] = pfm_intel_x86_get_encoding,
  66         PFMLIB_ENCODE_PERF(pfm_intel_x86_get_perf_encoding),
  67
  68        .get_event_first        = pfm_intel_x86_get_event_first,
  69        .get_event_next         = pfm_intel_x86_get_event_next,
  70        .event_is_valid         = pfm_intel_x86_event_is_valid,
  71        .validate_table         = pfm_intel_x86_validate_table,
  72        .get_event_info         = pfm_intel_x86_get_event_info,
  73        .get_event_attr_info    = pfm_intel_x86_get_event_attr_info,
  74        PFMLIB_VALID_PERF_PATTRS(pfm_intel_x86_perf_validate_pattrs),
  75        .get_event_nattrs       = pfm_intel_x86_get_event_nattrs,
  76};
  77