Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.

Commit d3af426

Browse files
author
Alif Ahmed
committed
Release v1.0
1 parent c4fabfa commit d3af426

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1278
-1067
lines changed

MAPProfiler/MAPProfiler.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,21 @@ KNOB<UINT64> knobMaxThreads(KNOB_MODE_WRITEONCE, "pintool", "threads", "10000",
4343
"Upper limit of the number of threads that can be used by the program \
4444
being profiled.");
4545

46+
// Stack based access logging (1: enable, 0: disable)
47+
KNOB<bool> knobStack(KNOB_MODE_WRITEONCE, "pintool", "stack", "0", "Stack based access logging \
48+
[1: enable, 0: disable (default)].");
49+
50+
// Instruction pointer relative access logging (1: enable, 0: disable)
51+
KNOB<bool> knobIP(KNOB_MODE_WRITEONCE, "pintool", "ip", "1", "IP relative access logging \
52+
[1: enable (default), 0: disable].");
53+
4654
// Read logging (1: enable, 0: disable)
4755
KNOB<bool> knobRead(KNOB_MODE_WRITEONCE, "pintool", "read", "1", "Read logging \
48-
(1: enable, 0: disable).");
56+
[1: enable (default), 0: disable].");
4957

5058
// Write logging (1: enable, 0: disable)
5159
KNOB<bool> knobWrite(KNOB_MODE_WRITEONCE, "pintool", "write", "1", "Write \
52-
logging (1: enable, 0: disable).");
60+
logging [1: enable (default), 0: disable].");
5361

5462

5563

@@ -107,7 +115,6 @@ bool read_log_en = true;
107115
bool write_log_en = true;
108116

109117

110-
111118
/*******************************************************************************
112119
* Functions
113120
******************************************************************************/
@@ -169,8 +176,16 @@ VOID RecordMemWrite(THREADID tid, ADDRINT ea) {
169176
* Instruments instructions having read or write accesses.
170177
*/
171178
VOID Instruction(INS ins, VOID *v){
172-
if(INS_IsStackRead(ins) || INS_IsStackWrite(ins)){
173-
return;
179+
if(!knobStack.Value()){
180+
if(INS_IsStackRead(ins) || INS_IsStackWrite(ins)){
181+
return;
182+
}
183+
}
184+
185+
if(!knobIP.Value()){
186+
if(INS_IsIpRelRead(ins) || INS_IsIpRelWrite(ins)){
187+
return;
188+
}
174189
}
175190

176191
// Get the memory operand count of the current instruction.

MAPProfiler/README

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,18 @@ IV. Usage
3737
------------------------------------------------
3838
logger.py is a wrapper which invokes appropriate pin tool command.
3939

40-
~$ ./logger.py [-h] [--version] [--pin-bin <path-to-pin-binary>]
41-
[--read {0,1}] [--write {0,1}] [--trace-file <trace-file>]
40+
~$ logger.py [-h] [--version] [--pin-bin <path-to-pin-binary>]
41+
[--read {0,1}] [--write {0,1}] [--stack-log {0,1}]
42+
[--ip-log {0,1}] [--trace-file <trace-file>]
4243
[--trace-limit <limit>] [--max-threads <limit>]
4344
[--func <func-to-trace>]
44-
<cmd> ...
45-
46-
Help on the arguments is shown by -h or --help option.
45+
<cmd>
4746

4847
positional arguments:
4948
<cmd> Command for running the program being profiled.
50-
...
5149

5250
optional arguments:
53-
-h, --help show this help message and exit
51+
-h, --help show help message and exit
5452
--version show program's version number and exit
5553
--pin-bin <path-to-pin-binary>
5654
Path to Intel Pin binary. If not given, derives from
@@ -61,6 +59,10 @@ IV. Usage
6159
enabled (defalut).
6260
--write {0,1} Controls write operation tracing. 0: disabled, 1:
6361
enabled (defalut).
62+
--stack-log {0,1} Controls stack based access logging. 0: disabled
63+
(default), 1: enabled.
64+
--ip-log {0,1} Controls instruction pointer relative access logging.
65+
0: disabled, 1: enabled (default).
6466
--trace-file <trace-file>
6567
Memory trace will be written to this file by Pin. The
6668
file is in simple human readable csv format. (default:
@@ -75,6 +77,7 @@ IV. Usage
7577
Function to trace. Fully qualified name should be used
7678
for C++ functions. (default: main)
7779

80+
7881
Sample command (after building example/openmp):
7982
~$ ./logger.py examples/openmp/omp
8083

@@ -130,8 +133,3 @@ IV. Usage
130133
This will open an interactive plot of the access pattern logged by mem_trace.csv.
131134

132135

133-
Copyright (c) 2019, University of Virginia
134-
All rights reserved.
135-
136-
137-

MAPProfiler/examples/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
###############################################################################
2+
#
3+
# Top level makefile. Forwards $(MAKE) calls to $(SUBDIRS) subdirectories.
4+
#
5+
# Author: Alif Ahmed
6+
# email: alifahmed@virginia.edu
7+
# Updated: Aug 06, 2019
8+
#
9+
###############################################################################
10+
11+
SUBDIRS = gather openmp rand scatter scatter_gather select_func seq
12+
13+
include makedir.mk
14+
15+

MAPProfiler/examples/README

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
11
Examples showcasing MAPProfiler usage.
22

3+
Build instructions
4+
==================
5+
6+
a) To build all examples, run 'make' from the current (examples) directory. e.g.,
7+
$ make
8+
b) To build a specific example, run 'make <example_name>' from the current directory. e.g.,
9+
$ make scatter
10+
c) Each example have their own makefile, which can also be uesd to build. e.g.,
11+
$ cd scatter
12+
$ make
13+
d) To clean all examples, run 'clean' from the current directory. e.g.,
14+
$ make clean
15+
e) To clean a specific example, run 'make <example_name>.clean'. e.g.,
16+
$ make scatter.clean
17+
f) Another way of cleaning specific examples:
18+
$ cd scatter
19+
$ make clean
20+
21+
22+
Included examples
23+
=================
24+
325
1. openmp:
426
Multithreaded (with OpenMp) sequential read, write and read-modify-write operations.
527

628
2. seq:
7-
Single threaded sequential read, write and read-modify-write operations.
29+
Single-threaded sequential read, write and read-modify-write operations.
830

931
3. rand:
10-
Single threaded rendom and sequential read, write and read-modify-write operations.
32+
Single-threaded random and sequential read, write and read-modify-write operations.
1133

1234
4. select_func:
1335
Example showing function selection.
@@ -19,4 +41,4 @@ Examples showcasing MAPProfiler usage.
1941
Scatter operation. Sequential read, random write.
2042

2143
7. scatter_gather:
22-
Scatter_gather operation. Sequential + random read, random write.
44+
Scatter-gather operation. Sequential + random read, random write.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.PHONY: all clean
22

3-
all: gather
3+
TARGET=gather
44

5-
gather: gather.c
6-
gcc -g -O0 gather.c -o gather
5+
all: $(TARGET)
6+
7+
$(TARGET): $(TARGET).c
8+
gcc -g -O0 $(TARGET).c -o $(TARGET)
79

810
clean:
9-
rm -rf gather
11+
rm -rf $(TARGET)

MAPProfiler/examples/makedir.mk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
###############################################################################
2+
#
3+
# Makefile helper. Forward $(MAKE) calls to the subdirectories specified by
4+
# $(SUBDIRS). This file is included by the top level makefiles.
5+
#
6+
# Author: Alif Ahmed
7+
# email: alifahmed@virginia.edu
8+
# Updated: Aug 06, 2019
9+
#
10+
###############################################################################
11+
12+
CLEAN_DIRS = $(addsuffix .clean,$(SUBDIRS))
13+
14+
.PHONY: all clean $(SUBDIRS) $(CLEAN_DIRS)
15+
16+
all: $(SUBDIRS)
17+
18+
clean: $(CLEAN_DIRS)
19+
20+
$(SUBDIRS):
21+
@$(MAKE) -C $@ --no-print-directory
22+
23+
$(CLEAN_DIRS): %.clean :
24+
@$(MAKE) -C $* --no-print-directory clean
25+
26+
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.PHONY: all clean
22

3-
all: omp
3+
TARGET=omp
44

5-
omp: omp.c
6-
gcc -g -O3 omp.c -o omp -fopenmp
5+
all: $(TARGET)
6+
7+
$(TARGET): $(TARGET).c
8+
gcc -g -O0 $(TARGET).c -o $(TARGET) -fopenmp
79

810
clean:
9-
rm -rf omp
11+
rm -rf $(TARGET)

MAPProfiler/examples/rand/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.PHONY: all clean
22

3-
all: rand
3+
TARGET=rand
44

5-
rand: rand.c
6-
gcc -g -O0 rand.c -o rand
5+
all: $(TARGET)
6+
7+
$(TARGET): $(TARGET).c
8+
gcc -g -O0 $(TARGET).c -o $(TARGET)
79

810
clean:
9-
rm -rf rand
11+
rm -rf $(TARGET)
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.PHONY: all clean
22

3-
all: scatter
3+
TARGET=scatter
44

5-
scatter: scatter.c
6-
gcc -g -O0 scatter.c -o scatter
5+
all: $(TARGET)
6+
7+
$(TARGET): $(TARGET).c
8+
gcc -g -O0 $(TARGET).c -o $(TARGET)
79

810
clean:
9-
rm -rf scatter
11+
rm -rf $(TARGET)
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.PHONY: all clean
22

3-
all: scatter_gather
3+
TARGET=scatter_gather
44

5-
scatter_gather: scatter_gather.c
6-
gcc -g -O0 scatter_gather.c -o scatter_gather
5+
all: $(TARGET)
6+
7+
$(TARGET): $(TARGET).c
8+
gcc -g -O0 $(TARGET).c -o $(TARGET)
79

810
clean:
9-
rm -rf scatter_gather
11+
rm -rf $(TARGET)

0 commit comments

Comments
 (0)