Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | /* * pmc.c * Copyright (C) 2001 Dave Engebretsen & Mike Corrigan IBM Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Change Activity: * 2001/06/05 : engebret : Created. * End Change Activity */ #include <asm/proc_fs.h> #include <asm/paca.h> #include <asm/iSeries/ItLpPaca.h> #include <asm/iSeries/ItLpQueue.h> #include <asm/processor.h> #include <linux/proc_fs.h> #include <linux/spinlock.h> #include <asm/pmc.h> #include <asm/uaccess.h> #include <asm/naca.h> struct _pmc_sw pmc_sw_system = { 0 }; struct _pmc_sw pmc_sw_cpu[NR_CPUS] = { {0 }, }; /* * Provide enough storage for either system level counters or * one cpu's counters. */ struct _pmc_sw_text pmc_sw_text; struct _pmc_hw_text pmc_hw_text; char * ppc64_pmc_stab(int file) { int n; unsigned long stab_faults, stab_capacity_castouts, stab_invalidations; unsigned long i; stab_faults = stab_capacity_castouts = stab_invalidations = n = 0; if (file == -1) { for (i = 0; i < NR_CPUS; i++) { if (!cpu_online(i)) continue; stab_faults += pmc_sw_cpu[i].stab_faults; stab_capacity_castouts += pmc_sw_cpu[i].stab_capacity_castouts; stab_invalidations += pmc_sw_cpu[i].stab_invalidations; } n += sprintf(pmc_sw_text.buffer + n, "Faults 0x%lx\n", stab_faults); n += sprintf(pmc_sw_text.buffer + n, "Castouts 0x%lx\n", stab_capacity_castouts); n += sprintf(pmc_sw_text.buffer + n, "Invalidations 0x%lx\n", stab_invalidations); } else { n += sprintf(pmc_sw_text.buffer + n, "Faults 0x%lx\n", pmc_sw_cpu[file].stab_faults); n += sprintf(pmc_sw_text.buffer + n, "Castouts 0x%lx\n", pmc_sw_cpu[file].stab_capacity_castouts); n += sprintf(pmc_sw_text.buffer + n, "Invalidations 0x%lx\n", pmc_sw_cpu[file].stab_invalidations); for (i = 0; i < STAB_ENTRY_MAX; i++) { if (pmc_sw_cpu[file].stab_entry_use[i]) { n += sprintf(pmc_sw_text.buffer + n, "Entry %02ld 0x%lx\n", i, pmc_sw_cpu[file].stab_entry_use[i]); } } } return(pmc_sw_text.buffer); } char * ppc64_pmc_htab(int file) { int n; unsigned long htab_primary_overflows, htab_capacity_castouts; unsigned long htab_read_to_write_faults; htab_primary_overflows = htab_capacity_castouts = 0; htab_read_to_write_faults = n = 0; if (file == -1) { n += sprintf(pmc_sw_text.buffer + n, "Primary Overflows 0x%lx\n", pmc_sw_system.htab_primary_overflows); n += sprintf(pmc_sw_text.buffer + n, "Castouts 0x%lx\n", pmc_sw_system.htab_capacity_castouts); } else { n += sprintf(pmc_sw_text.buffer + n, "Primary Overflows N/A\n"); n += sprintf(pmc_sw_text.buffer + n, "Castouts N/A\n\n"); } return(pmc_sw_text.buffer); } char * ppc64_pmc_hw(int file) { int n; n = 0; if (file == -1) { n += sprintf(pmc_hw_text.buffer + n, "Not Implemented\n"); } else { n += sprintf(pmc_hw_text.buffer + n, "MMCR0 0x%lx\n", mfspr(MMCR0)); n += sprintf(pmc_hw_text.buffer + n, "MMCR1 0x%lx\n", mfspr(MMCR1)); #if 0 n += sprintf(pmc_hw_text.buffer + n, "MMCRA 0x%lx\n", mfspr(MMCRA)); #endif n += sprintf(pmc_hw_text.buffer + n, "PMC1 0x%lx\n", mfspr(PMC1)); n += sprintf(pmc_hw_text.buffer + n, "PMC2 0x%lx\n", mfspr(PMC2)); n += sprintf(pmc_hw_text.buffer + n, "PMC3 0x%lx\n", mfspr(PMC3)); n += sprintf(pmc_hw_text.buffer + n, "PMC4 0x%lx\n", mfspr(PMC4)); n += sprintf(pmc_hw_text.buffer + n, "PMC5 0x%lx\n", mfspr(PMC5)); n += sprintf(pmc_hw_text.buffer + n, "PMC6 0x%lx\n", mfspr(PMC6)); n += sprintf(pmc_hw_text.buffer + n, "PMC7 0x%lx\n", mfspr(PMC7)); n += sprintf(pmc_hw_text.buffer + n, "PMC8 0x%lx\n", mfspr(PMC8)); } return(pmc_hw_text.buffer); } |