basic_components.cc revision 10152
110152Satgutier@umich.edu/***************************************************************************** 210152Satgutier@umich.edu * McPAT 310152Satgutier@umich.edu * SOFTWARE LICENSE AGREEMENT 410152Satgutier@umich.edu * Copyright 2012 Hewlett-Packard Development Company, L.P. 510152Satgutier@umich.edu * All Rights Reserved 610152Satgutier@umich.edu * 710152Satgutier@umich.edu * Redistribution and use in source and binary forms, with or without 810152Satgutier@umich.edu * modification, are permitted provided that the following conditions are 910152Satgutier@umich.edu * met: redistributions of source code must retain the above copyright 1010152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer; 1110152Satgutier@umich.edu * redistributions in binary form must reproduce the above copyright 1210152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer in the 1310152Satgutier@umich.edu * documentation and/or other materials provided with the distribution; 1410152Satgutier@umich.edu * neither the name of the copyright holders nor the names of its 1510152Satgutier@umich.edu * contributors may be used to endorse or promote products derived from 1610152Satgutier@umich.edu * this software without specific prior written permission. 1710152Satgutier@umich.edu 1810152Satgutier@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1910152Satgutier@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2010152Satgutier@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2110152Satgutier@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2210152Satgutier@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2310152Satgutier@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2410152Satgutier@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2510152Satgutier@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2610152Satgutier@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2710152Satgutier@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2810152Satgutier@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.” 2910152Satgutier@umich.edu * 3010152Satgutier@umich.edu ***************************************************************************/ 3110152Satgutier@umich.edu 3210152Satgutier@umich.edu#include <cassert> 3310152Satgutier@umich.edu#include <cmath> 3410152Satgutier@umich.edu#include <iostream> 3510152Satgutier@umich.edu 3610152Satgutier@umich.edu#include "basic_components.h" 3710152Satgutier@umich.edu 3810152Satgutier@umich.edudouble longer_channel_device_reduction( 3910152Satgutier@umich.edu enum Device_ty device_ty, 4010152Satgutier@umich.edu enum Core_type core_ty) 4110152Satgutier@umich.edu{ 4210152Satgutier@umich.edu 4310152Satgutier@umich.edu double longer_channel_device_percentage_core; 4410152Satgutier@umich.edu double longer_channel_device_percentage_uncore; 4510152Satgutier@umich.edu double longer_channel_device_percentage_llc; 4610152Satgutier@umich.edu 4710152Satgutier@umich.edu double long_channel_device_reduction; 4810152Satgutier@umich.edu 4910152Satgutier@umich.edu longer_channel_device_percentage_llc = 1.0; 5010152Satgutier@umich.edu longer_channel_device_percentage_uncore = 0.82; 5110152Satgutier@umich.edu if (core_ty==OOO) 5210152Satgutier@umich.edu { 5310152Satgutier@umich.edu longer_channel_device_percentage_core = 0.56;//0.54 Xeon Tulsa //0.58 Nehelam 5410152Satgutier@umich.edu //longer_channel_device_percentage_uncore = 0.76;//0.85 Nehelam 5510152Satgutier@umich.edu 5610152Satgutier@umich.edu } 5710152Satgutier@umich.edu else 5810152Satgutier@umich.edu { 5910152Satgutier@umich.edu longer_channel_device_percentage_core = 0.8;//0.8;//Niagara 6010152Satgutier@umich.edu //longer_channel_device_percentage_uncore = 0.9;//Niagara 6110152Satgutier@umich.edu } 6210152Satgutier@umich.edu 6310152Satgutier@umich.edu if (device_ty==Core_device) 6410152Satgutier@umich.edu { 6510152Satgutier@umich.edu long_channel_device_reduction = (1- longer_channel_device_percentage_core) 6610152Satgutier@umich.edu + longer_channel_device_percentage_core * g_tp.peri_global.long_channel_leakage_reduction; 6710152Satgutier@umich.edu } 6810152Satgutier@umich.edu else if (device_ty==Uncore_device) 6910152Satgutier@umich.edu { 7010152Satgutier@umich.edu long_channel_device_reduction = (1- longer_channel_device_percentage_uncore) 7110152Satgutier@umich.edu + longer_channel_device_percentage_uncore * g_tp.peri_global.long_channel_leakage_reduction; 7210152Satgutier@umich.edu } 7310152Satgutier@umich.edu else if (device_ty==LLC_device) 7410152Satgutier@umich.edu { 7510152Satgutier@umich.edu long_channel_device_reduction = (1- longer_channel_device_percentage_llc) 7610152Satgutier@umich.edu + longer_channel_device_percentage_llc * g_tp.peri_global.long_channel_leakage_reduction; 7710152Satgutier@umich.edu } 7810152Satgutier@umich.edu else 7910152Satgutier@umich.edu { 8010152Satgutier@umich.edu cout<<"unknown device category"<<endl; 8110152Satgutier@umich.edu exit(0); 8210152Satgutier@umich.edu } 8310152Satgutier@umich.edu 8410152Satgutier@umich.edu return long_channel_device_reduction; 8510152Satgutier@umich.edu} 8610152Satgutier@umich.edu 8710152Satgutier@umich.edustatsComponents operator+(const statsComponents & x, const statsComponents & y) 8810152Satgutier@umich.edu{ 8910152Satgutier@umich.edu statsComponents z; 9010152Satgutier@umich.edu 9110152Satgutier@umich.edu z.access = x.access + y.access; 9210152Satgutier@umich.edu z.hit = x.hit + y.hit; 9310152Satgutier@umich.edu z.miss = x.miss + y.miss; 9410152Satgutier@umich.edu 9510152Satgutier@umich.edu return z; 9610152Satgutier@umich.edu} 9710152Satgutier@umich.edu 9810152Satgutier@umich.edustatsComponents operator*(const statsComponents & x, double const * const y) 9910152Satgutier@umich.edu{ 10010152Satgutier@umich.edu statsComponents z; 10110152Satgutier@umich.edu 10210152Satgutier@umich.edu z.access = x.access*y[0]; 10310152Satgutier@umich.edu z.hit = x.hit*y[1]; 10410152Satgutier@umich.edu z.miss = x.miss*y[2]; 10510152Satgutier@umich.edu 10610152Satgutier@umich.edu return z; 10710152Satgutier@umich.edu} 10810152Satgutier@umich.edu 10910152Satgutier@umich.edustatsDef operator+(const statsDef & x, const statsDef & y) 11010152Satgutier@umich.edu{ 11110152Satgutier@umich.edu statsDef z; 11210152Satgutier@umich.edu 11310152Satgutier@umich.edu z.readAc = x.readAc + y.readAc; 11410152Satgutier@umich.edu z.writeAc = x.writeAc + y.writeAc; 11510152Satgutier@umich.edu z.searchAc = x.searchAc + y.searchAc; 11610152Satgutier@umich.edu return z; 11710152Satgutier@umich.edu} 11810152Satgutier@umich.edu 11910152Satgutier@umich.edustatsDef operator*(const statsDef & x, double const * const y) 12010152Satgutier@umich.edu{ 12110152Satgutier@umich.edu statsDef z; 12210152Satgutier@umich.edu 12310152Satgutier@umich.edu z.readAc = x.readAc*y; 12410152Satgutier@umich.edu z.writeAc = x.writeAc*y; 12510152Satgutier@umich.edu z.searchAc = x.searchAc*y; 12610152Satgutier@umich.edu return z; 12710152Satgutier@umich.edu} 128