Skip to content

Commit 4e8613b

Browse files
committed
parsers
1 parent b580eb2 commit 4e8613b

3 files changed

Lines changed: 79 additions & 28 deletions

File tree

ASPLOS20-README.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
3+
24
## Overview
35

46
**Paper** : Atomicity Checking in Linear Time using Vector Clocks, ASPLOS'20
@@ -15,8 +17,9 @@ Here we describe how to run AeroDrome and Velodrome to reproduce results from ou
1517
## Directory Structure
1618

1719
```
18-
Paper576-AE
20+
AE/
1921
|--- README.md
22+
|--- LICENSE
2023
|--- atomicity_specs/
2124
|--- benchmarks/
2225
|--- scripts/
@@ -46,11 +49,12 @@ For this, we need our tool [RAPID](https://github.com/umangm/rapid/). RAPID can
4649
- The [`Velodrome`]([https://github.com/umangm/rapid/blob/master/src/Velodrome.java](https://github.com/umangm/rapid/blob/master/src/Velodrome.java)) in RAPID determines atomicity violations using the prior state-of-the-art algorithm Velodrome.
4750

4851
**Remark** - In the following we will assume that the directory in which this `README` file is located is stored in the environment variables $AE_HOME.
49-
For example, if your directory is `/path/to/Paper576-AE/`, then you would execute:
52+
For example, if your directory is `/path/to/AE/`, then you would execute:
5053
```
51-
export AE_HOME=/path/to/asplos-ae
54+
export AE_HOME=/path/to/AE/
5255
```
5356
Also, you need to change the variable `home` in the file `scripts/util.py` (line 17) to be the value of $AE_HOME .
57+
Also set the environment variables `JAVA_HOME` and `JVM_ARGS` in the same file.
5458

5559
## Steps 1 & 2: Generating traces and Accounting for Atomicity Specifications
5660

@@ -66,8 +70,9 @@ mv $AE_HOME/asplos20-ae-traces $AE_HOME/benchmarks/
6670
### Download and install Roadrunner :
6771
```
6872
cd $AE_HOME
69-
git clone https://github.com/stephenfreund/RoadRunner
73+
git clone git@github.com:stephenfreund/RoadRunner.git
7074
cd $AE_HOME/RoadRunner
75+
wget https://raw.githubusercontent.com/umangm/rapid/master/notes/PrintSubsetTool.java.txt -O $AE_HOME/RoadRunner/src/rr/simple/PrintSubsetTool.java
7176
ant
7277
source msetup
7378
```
@@ -89,6 +94,13 @@ This step generates files `$AE_HOME/benchmarks/<b>/full_trace.rr`, either for pa
8994

9095

9196
### Account for atomicity specifications
97+
First install RAPID -
98+
```
99+
cd $AE_HOME
100+
git clone git@github.com:umangm/rapid.git
101+
cd $AE_HOME/rapid
102+
ant jar
103+
```
92104

93105
If you want to modify the trace for a single benchmark:
94106
```
@@ -107,6 +119,15 @@ At this point, the files `$AE_HOME/benchmarks/<b>/full_trace.rr` are redundant.
107119

108120
## Step-3: Analyses
109121

122+
### Install RAPID
123+
If not already installed, perform the following steps:
124+
```
125+
cd $AE_HOME
126+
git clone git@github.com:umangm/rapid.git
127+
cd $AE_HOME/rapid
128+
ant jar
129+
```
130+
110131
### Getting Trace metadata
111132

112133
If you want to get the metadata about the trace of a single benchmark:
@@ -164,7 +185,7 @@ python aerodrome.py <b>
164185
```
165186
Here, `<b>` could be something like `philo`.
166187

167-
Alternatively, if you have generated `trace.rr` for all benchmarks, you could analyze the traces for all benchmarks as follows.
188+
Alternatively, if you have generated `trace.std` for all benchmarks, you could analyze the traces for all benchmarks as follows.
168189
```
169190
python aerodrome.py
170191
```
@@ -184,11 +205,10 @@ Number of events analyzed = 6176
184205
Atomicity violation detected.
185206
Time for full analysis = 65 milliseconds
186207
```
187-
The last three lines are the most important lines.
208+
The second line indicates that before the analyses finished, the first 6176 events in the trace were analyzed by AeroDrome.
209+
The third line denotes that an atomicity violation was reported by AeroDrome.
210+
In examples when no violation is reported, this line would be `No atomicity violation detected.`
188211
The last line reports the total time taken.
189-
The penultimate line denotes that a violation is found. If there is no violation, it says `No atomicity violation detected.`.
190-
The 3rd last line indicates the total number of events analyzed before the violation was reported (or all events if no violation was reported).
191-
The other lines are for debugging purposes.
192212

193213
The file `aerodrome.tim` reports the time taken.
194214

@@ -215,18 +235,16 @@ The file `velodrome.err` should ideally be empty. If it is not empty, it contain
215235
The file `velodrome.txt` contains the actual output.
216236
An example is below:
217237
```
218-
2
219238
Analysis complete
220-
Atomicity violation detected.
221239
Number of events analyzed = 6176
240+
Atomicity violation detected.
222241
Number of transactions remaining = 5
223242
Time for full analysis = 61 milliseconds
224243
```
225-
The last four lines are the most important lines.
244+
The second line indicates that before the analyses finished, the first 6176 events in the trace were analyzed by Velodrome.
245+
The third line denotes that an atomicity violation was reported by Velodrome.
246+
In examples when no violation is reported, this line would be `No atomicity violation detected.`
247+
The fourth line indicates the total number of events analyzed before the violation was reported (or all events if no violation was reported).
226248
The last line reports the total time taken.
227-
The 2nd last line denotes the number of transactions remaining in the transaction graph of Velodrome's analysis at the time the analysis ended.
228-
The 3rd last line denotes that a violation is found. If there is no violation, it says `No atomicity violation detected.`.
229-
The 4th last line indicates the total number of events analyzed before the violation was reported (or all events if no violation was reported).
230-
The other lines are for debugging purposes.
231249

232250
The file `velodrome.tim` reports the time taken.

src/parse/std/Parse.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import parse.util.EventInfo;
1010

1111
public class Parse {
12-
// ACQUIRE, RELEASE, READ, WRITE, FORK, JOIN;
12+
// ACQUIRE, RELEASE, READ, WRITE, FORK, JOIN, BEGIN, END, BRANCH;
1313
public static String matchStr[] = { "acq", "rel", "r", "w", "fork", "join", "begin", "end", "dummy" };
1414

1515
public static String prefixPattern = "^(";
@@ -34,16 +34,17 @@ public Parse() {
3434

3535
public static void example() {
3636
// String line = "345|T20|sync(z)";
37-
String line = "345|T20|join(T1)";
37+
// String line = "T20|join(T1)|345";
38+
String line = "T20|branch|345";
3839
Parse parse = new Parse();
3940
EventInfo eInfo = new EventInfo();
4041
try{
4142
parse.getInfo(eInfo, line);
42-
System.out.println(eInfo);
4343
}
4444
catch(CannotParseException e){
4545
System.out.println("Could not parse !");
4646
}
47+
System.out.println("Parsed successfully : " + eInfo);
4748
}
4849

4950
public void getInfoOp(EventInfo eInfo, String th, String loc, Matcher matcher) {
@@ -62,18 +63,27 @@ public void getInfo(EventInfo eInfo, String line) throws CannotParseException {
6263
String thId = eArray[0];
6364
String op = eArray[1];
6465
String locId = eArray[2];
65-
Matcher matcher = genericEventPattern.matcher(op);
66-
if (matcher.find()) {
67-
Matcher primitiveMatcher = primitiveEventPattern.matcher(op);
68-
if(primitiveMatcher.find()){
69-
getInfoOp(eInfo, thId, locId, primitiveMatcher);
70-
}
71-
else{
66+
if(op.startsWith("begin")){
67+
eInfo.updateEventInfo(EventType.BEGIN, thId, null, locId);
68+
}
69+
else if(op.startsWith("end")){
70+
eInfo.updateEventInfo(EventType.END, thId, null, locId);
71+
}
72+
else{
73+
Matcher matcher = genericEventPattern.matcher(op);
74+
if (matcher.find()) {
75+
Matcher primitiveMatcher = primitiveEventPattern.matcher(op);
76+
if(primitiveMatcher.find()){
77+
getInfoOp(eInfo, thId, locId, primitiveMatcher);
78+
}
79+
else{
80+
throw new CannotParseException(line);
81+
}
82+
} else {
7283
throw new CannotParseException(line);
7384
}
74-
} else {
75-
throw new CannotParseException(line);
7685
}
86+
7787
}
7888
}
7989

src/parse/std/ParseStandard.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ else if (eInfo.type.isJoin()) {
135135

136136
e.updateEvent(totEvents, LID, ename, eInfo.type, t, null, null, target);
137137
}
138+
139+
else if (eInfo.type.isBegin()) {
140+
e.updateEvent(totEvents, LID, ename, eInfo.type, t, null, null, null);
141+
}
142+
143+
else if (eInfo.type.isEnd()) {
144+
e.updateEvent(totEvents, LID, ename, eInfo.type, t, null, null, null);
145+
}
138146

139147
else {
140148
throw new IllegalArgumentException("Illegal type of event " + eInfo.type.toString());
@@ -173,4 +181,19 @@ public boolean hasNext(){
173181
public int getTotalThreads(){
174182
return totThreads;
175183
}
184+
185+
public static void demo(){
186+
String traceFile = "/Users/umang/Desktop/trace.txt";
187+
Event e = new Event();
188+
ParseStandard parser = new ParseStandard(traceFile);
189+
while(parser.hasNext()){
190+
parser.getNextEvent(e);
191+
System.out.println(e.toCompactString());
192+
}
193+
}
194+
195+
public static void main(String args[]){
196+
demo();
197+
}
198+
176199
}

0 commit comments

Comments
 (0)