akaros/user/perfmon/pfmlib_intel_atom.c
<<
>>
Prefs
   1/*
   2 * pfmlib_intel_atom.c : Intel Atom PMU
   3 *
   4 * Copyright (c) 2008 Google, Inc
   5 * Contributed by Stephane Eranian <eranian@gmail.com>
   6 *
   7 * Based on work:
   8 * Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
   9 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
  10 *
  11 * Permission is hereby granted, free of charge, to any person obtaining a copy
  12 * of this software and associated documentation files (the "Software"), to deal
  13 * in the Software without restriction, including without limitation the rights
  14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  15 * of the Software, and to permit persons to whom the Software is furnished to do so,
  16 * subject to the following conditions:
  17 *
  18 * The above copyright notice and this permission notice shall be included in all
  19 * copies or substantial portions of the Software.
  20 *
  21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  22 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  23 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  24 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
  25 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  26 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27 *
  28 *
  29 * This file implements support for Intel Core PMU as specified in the following document:
  30 *      "IA-32 Intel Architecture Software Developer's Manual - Volume 3B: System
  31 *      Programming Guide"
  32 *
  33 * Intel Atom = architectural v3 + PEBS
  34 */
  35/* private headers */
  36#include "pfmlib_priv.h"
  37#include "pfmlib_intel_x86_priv.h"
  38#include "events/intel_atom_events.h"
  39
  40static const int atom_models[] = {
  41        28, /* Pineview/Silverthorne */
  42        38, /* Lincroft */
  43        39, /* Penwell */
  44        53, /* Cloverview */
  45        54, /* Cedarview */
  46        0
  47};
  48
  49static int
  50pfm_intel_atom_init(void *this)
  51{
  52        pfm_intel_x86_cfg.arch_version = 3;
  53        return PFM_SUCCESS;
  54}
  55
  56pfmlib_pmu_t intel_atom_support={
  57        .desc                   = "Intel Atom",
  58        .name                   = "atom",
  59        .pmu                    = PFM_PMU_INTEL_ATOM,
  60        .pme_count              = LIBPFM_ARRAY_SIZE(intel_atom_pe),
  61        .type                   = PFM_PMU_TYPE_CORE,
  62        .num_cntrs              = 2,
  63        .num_fixed_cntrs        = 3,
  64        .max_encoding           = 1,
  65        .pe                     = intel_atom_pe,
  66        .atdesc                 = intel_x86_mods,
  67        .flags                  = PFMLIB_PMU_FL_RAW_UMASK,
  68        .supported_plm          = INTEL_X86_PLM,
  69
  70        .cpu_family             = 6,
  71        .cpu_models             = atom_models,
  72        .pmu_detect             = pfm_intel_x86_model_detect,
  73        .pmu_init               = pfm_intel_atom_init,
  74
  75        .get_event_encoding[PFM_OS_NONE] = pfm_intel_x86_get_encoding,
  76         PFMLIB_ENCODE_PERF(pfm_intel_x86_get_perf_encoding),
  77
  78        .get_event_first        = pfm_intel_x86_get_event_first,
  79        .get_event_next         = pfm_intel_x86_get_event_next,
  80        .event_is_valid         = pfm_intel_x86_event_is_valid,
  81        .validate_table         = pfm_intel_x86_validate_table,
  82        .get_event_info         = pfm_intel_x86_get_event_info,
  83        .get_event_attr_info    = pfm_intel_x86_get_event_attr_info,
  84        PFMLIB_VALID_PERF_PATTRS(pfm_intel_x86_perf_validate_pattrs),
  85        .get_event_nattrs       = pfm_intel_x86_get_event_nattrs,
  86};
  87