Skip to content

Commit

Permalink
Merge pull request umd-memsys#51 from cota/for_dramninjas
Browse files Browse the repository at this point in the history
For dramninjas
  • Loading branch information
dramninjasUMD committed Nov 8, 2014
2 parents 1d206a7 + a016449 commit 9470146
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ results/
*.o
*.po
*.dep
*.deppo
*.swp
DRAMSim
libdramsim.a
libdramsim.so
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ endif
CXXFLAGS+=$(OPTFLAGS)

EXE_NAME=DRAMSim
STATIC_LIB_NAME := libdramsim.a
LIB_NAME=libdramsim.so
LIB_NAME_MACOS=libdramsim.dylib

SRC = $(wildcard *.cpp)
OBJ = $(addsuffix .o, $(basename $(SRC)))

LIB_SRC := $(filter-out TraceBasedSim.cpp,$(SRC))
LIB_OBJ := $(addsuffix .o, $(basename $(LIB_SRC)))

#build portable objects (i.e. with -fPIC)
POBJ = $(addsuffix .po, $(basename $(SRC)))
POBJ = $(addsuffix .po, $(basename $(LIB_SRC)))

REBUILDABLES=$(OBJ) ${POBJ} $(EXE_NAME) $(LIB_NAME)
REBUILDABLES=$(OBJ) ${POBJ} $(EXE_NAME) $(LIB_NAME) $(STATIC_LIB_NAME)

all: ${EXE_NAME}

Expand All @@ -32,6 +36,9 @@ $(LIB_NAME): $(POBJ)
g++ -g -shared -Wl,-soname,$@ -o $@ $^
@echo "Built $@ successfully"

$(STATIC_LIB_NAME): $(LIB_OBJ)
$(AR) crs $@ $^

$(LIB_NAME_MACOS): $(POBJ)
g++ -dynamiclib -o $@ $^
@echo "Built $@ successfully"
Expand Down
11 changes: 11 additions & 0 deletions PrintMacros.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "PrintMacros.h"

/*
* Enable or disable PRINT() statements.
*
* Set by flag in TraceBasedSim.cpp when compiling standalone DRAMSim tool.
*
* The DRAMSim libraries do not include the TraceBasedSim object and thus
* library users can optionally override the weak definition below.
*/
int __attribute__((weak)) SHOW_SIM_OUTPUT = false;
4 changes: 3 additions & 1 deletion PrintMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
#ifndef PRINT_MACROS_H
#define PRINT_MACROS_H

extern int SHOW_SIM_OUTPUT; //enable or disable PRINT() statements -- set by flag in TraceBasedSim.cpp
#include <iostream>

extern int SHOW_SIM_OUTPUT;

#define ERROR(str) std::cerr<<"[ERROR ("<<__FILE__<<":"<<__LINE__<<")]: "<<str<<std::endl;

Expand Down
2 changes: 1 addition & 1 deletion TraceBasedSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ int main(int argc, char **argv)
MultiChannelMemorySystem *memorySystem = new MultiChannelMemorySystem(deviceIniFilename, systemIniFilename, pwdString, traceFileName, megsOfMemory, visFilename, paramOverrides);
// set the frequency ratio to 1:1
memorySystem->setCPUClockSpeed(0);
std::ostream &dramsim_logfile = memorySystem->getLogFile();

// don't need this anymore
delete paramOverrides;

Expand Down
1 change: 1 addition & 0 deletions example_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dramsim_test
2 changes: 1 addition & 1 deletion example_app/dramsim_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int some_object::add_one_and_run(MultiChannelMemorySystem *mem, uint64_t addr)
}

/* get a nice summary of this epoch */
mem->printStats();
mem->printStats(true);

return 0;
}
Expand Down
1 change: 1 addition & 0 deletions traces/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.trc

0 comments on commit 9470146

Please sign in to comment.