Skip to content

Commit

Permalink
Minor changes to ensure table can be easily replicated
Browse files Browse the repository at this point in the history
  • Loading branch information
mahills committed May 12, 2014
1 parent 327f335 commit fae99e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/lang/php/analysis/includes/IncludesInfo.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ data IncludesInfo
map[str, Expr] constMap,
map[str, map[str, Expr]] classConstMap);
public bool includesInfoExists(str p, str v) {
return exists(infoLoc + "<p>-<v>-l2c.bin") && exists(infoLoc + "<p>-<v>-crel.bin") && exists(infoLoc + "<p>-<v>-cmap.bin") && exists(infoLoc + "<p>-<v>-ccmap.bin");
}
public IncludesInfo loadIncludesInfo(str p, str v) {
map[loc,set[ConstItemExp]] loc2consts = readBinaryValueFile(#map[loc,set[ConstItemExp]], infoLoc + "<p>-<v>-l2c.bin");
rel[ConstItem,loc,Expr] constRel = readBinaryValueFile(#rel[ConstItem,loc,Expr], infoLoc + "<p>-<v>-crel.bin");
Expand Down
21 changes: 12 additions & 9 deletions src/lang/php/experiments/ase2014/ASE2014.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void doQuickResolve() {
public void doQuickResolve(Corpus corpus) {
for (p <- corpus, v := corpus[p]) {
pt = loadBinary(p,v);
if (!includesInfoExists(p,v)) buildIncludesInfo(p,v,getCorpusItem(p,v));
IncludesInfo iinfo = loadIncludesInfo(p, v);
rel[loc,loc,loc] res = { };
map[loc,Duration] timings = ( );
Expand Down Expand Up @@ -218,14 +219,18 @@ public str createQuickResolveCountsTable() {
corpus = getBaseCorpus();
str headerLine() {
return "System & Includes & Dynamic & Unique & Missing & Any & Other & Average \\\\ \\midrule";
res = "System & \\multicolumn{3}{c}{Includes} & \\phantom{abc} & \\multicolumn{5}{c}{Results} \\\\
'\\cmidrule{2-4} \\cmidrule{6-10}
' & Total & Static & Dynamic & & Unique & Missing & Any & Other & Average \\\\ \\midrule";
return res;
}
str productLine(str p, str v) {
map[int hits, int includes] m = counts[<p,v>];
total = ( 0 | it + m[h] | h <- m<0> );
pt = loadBinary(p,v);
dyn = total - size([ i | /i:include(ip,_) := pt, scalar(sv) := ip, encapsed(_) !:= sv ]);
st = total - dyn;
unique = (1 in m) ? m[1] : 0;
missing = (0 in m) ? m[0] : 0;
files = size(pt<0>);
Expand All @@ -235,23 +240,21 @@ public str createQuickResolveCountsTable() {
denom = ( 0 | it + m[h] | h <- m<0>, h > 1, h < threshold );
avg = (denom == 0) ? 0 : ( ( 0 | it + (m[h] * h) | h <- m<0>, h > 1, h < threshold ) * 1.000 / denom);
return "<p> & \\numprint{<total>} & \\numprint{<dyn>} & \\numprint{<unique>} & \\numprint{<missing>} & \\numprint{<anyinc>} & \\numprint{<other>} & \\nprounddigits{2} \\numprint{<avg>} \\npnoround \\\\";
return "<p> & \\numprint{<total>} & \\numprint{<st>} & \\numprint{<dyn>} & & \\numprint{<unique>} & \\numprint{<missing>} & \\numprint{<anyinc>} & \\numprint{<other>} & \\nprounddigits{2} \\numprint{<avg>} \\npnoround \\\\";
}
res = "\\npaddmissingzero
'\\npfourdigitsep
'\\begin{table}
'\\begin{table*}
'\\centering
'\\ra{1.0}
'\\resizebox{\\columnwidth}{!}{%
'\\begin{tabular}{@{}lrrrrrrr@{}} \\toprule
'\\ra{1.2}
'\\begin{tabular}{@{}lrrrcrrrrr@{}} \\toprule
'<headerLine()> <for (p <- sort(toList(corpus<0>),bool(str s1,str s2) { return toUpperCase(s1)<toUpperCase(s2); })) {>
' <productLine(p,corpus[p])> <}>
'\\bottomrule
'\\end{tabular}
'}
'\\caption{File-Level Resolution.\\label{table-quick}}
'\\end{table}
'\\caption{Results of running {\\sf FLRES} on the corpus.\\label{table-quick}}
'\\end{table*}
'";
return res;
}
Expand Down

0 comments on commit fae99e9

Please sign in to comment.