LibDRAMPower.h revision 10428
19665Sandreas.hansson@arm.com/*
29665Sandreas.hansson@arm.com * Copyright (c) 2012-2014, TU Delft
39665Sandreas.hansson@arm.com * Copyright (c) 2012-2014, TU Eindhoven
49665Sandreas.hansson@arm.com * Copyright (c) 2012-2014, TU Kaiserslautern
59665Sandreas.hansson@arm.com * All rights reserved.
69665Sandreas.hansson@arm.com *
79665Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without
89665Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are
99665Sandreas.hansson@arm.com * met:
109665Sandreas.hansson@arm.com *
119665Sandreas.hansson@arm.com * 1. Redistributions of source code must retain the above copyright
129665Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer.
135353Svilas.sridharan@gmail.com *
143395Shsul@eecs.umich.edu * 2. Redistributions in binary form must reproduce the above copyright
153395Shsul@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
163395Shsul@eecs.umich.edu * documentation and/or other materials provided with the distribution.
173395Shsul@eecs.umich.edu *
183395Shsul@eecs.umich.edu * 3. Neither the name of the copyright holder nor the names of its
193395Shsul@eecs.umich.edu * contributors may be used to endorse or promote products derived from
203395Shsul@eecs.umich.edu * this software without specific prior written permission.
213395Shsul@eecs.umich.edu *
223395Shsul@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
233395Shsul@eecs.umich.edu * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
243395Shsul@eecs.umich.edu * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
253395Shsul@eecs.umich.edu * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
263395Shsul@eecs.umich.edu * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
273395Shsul@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
283395Shsul@eecs.umich.edu * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
293395Shsul@eecs.umich.edu * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
303395Shsul@eecs.umich.edu * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
313395Shsul@eecs.umich.edu * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
323395Shsul@eecs.umich.edu * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
333395Shsul@eecs.umich.edu *
343395Shsul@eecs.umich.edu * Authors: Matthias Jung, Omar Naji
353395Shsul@eecs.umich.edu *
363395Shsul@eecs.umich.edu */
373395Shsul@eecs.umich.edu
383395Shsul@eecs.umich.edu#ifndef LIB_DRAM_POWER_H
393395Shsul@eecs.umich.edu#define LIB_DRAM_POWER_H
403395Shsul@eecs.umich.edu
418920Snilay@cs.wisc.edu#include <stdint.h>
428920Snilay@cs.wisc.edu#include <vector>
438920Snilay@cs.wisc.edu
4411688Sandreas.hansson@arm.com#include "CommandAnalysis.h"
457025SBrad.Beckmann@amd.com#include "MemoryPowerModel.h"
4611688Sandreas.hansson@arm.com#include "MemCommand.h"
4713432Spau.cabre@metempsy.com
4811688Sandreas.hansson@arm.comclass libDRAMPower {
4911688Sandreas.hansson@arm.com public:
5010747SChris.Emmons@arm.com  libDRAMPower(const Data::MemorySpecification& memSpec, bool includeIoAndTermination);
519520SAndreas.Sandberg@ARM.com  ~libDRAMPower();
529520SAndreas.Sandberg@ARM.com
539520SAndreas.Sandberg@ARM.com  void doCommand(Data::MemCommand::cmds type,
549520SAndreas.Sandberg@ARM.com                 int                    bank,
5513432Spau.cabre@metempsy.com                 int64_t                timestamp);
5613432Spau.cabre@metempsy.com
5713432Spau.cabre@metempsy.com  void updateCounters(bool lastUpdate);
5813432Spau.cabre@metempsy.com
599665Sandreas.hansson@arm.com  void clearState();
609665Sandreas.hansson@arm.com
619665Sandreas.hansson@arm.com  void calcEnergy();
629665Sandreas.hansson@arm.com
6311238Sandreas.sandberg@arm.com  const Data::MemoryPowerModel::Energy& getEnergy() const;
6411238Sandreas.sandberg@arm.com  const Data::MemoryPowerModel::Power& getPower() const;
6511238Sandreas.sandberg@arm.com
6611238Sandreas.sandberg@arm.com  // list of all commands
6711688Sandreas.hansson@arm.com  std::vector<Data::MemCommand> cmdList;
6811688Sandreas.hansson@arm.com private:
6911688Sandreas.hansson@arm.com  Data::MemorySpecification memSpec;
7011688Sandreas.hansson@arm.com public:
718920Snilay@cs.wisc.edu  Data::CommandAnalysis counters;
729827Sakash.bagdia@arm.com private:
739827Sakash.bagdia@arm.com  bool includeIoAndTermination;
749827Sakash.bagdia@arm.com  // Object of MemoryPowerModel which contains the results
759827Sakash.bagdia@arm.com  // Energies(pJ) stored in energy, Powers(mW) stored in power. Number of
769790Sakash.bagdia@arm.com  // each command stored in timings.
779790Sakash.bagdia@arm.com  Data::MemoryPowerModel mpm;
789790Sakash.bagdia@arm.com};
799790Sakash.bagdia@arm.com
8011688Sandreas.hansson@arm.com#endif // ifndef LIB_DRAM_POWER_H
8111688Sandreas.hansson@arm.com