Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into oraculariserisation
Browse files Browse the repository at this point in the history
  • Loading branch information
scyptnex committed Oct 7, 2016
2 parents 3460b0c + ea0b2e1 commit ae42e7b
Show file tree
Hide file tree
Showing 66 changed files with 61,168 additions and 137 deletions.
3 changes: 2 additions & 1 deletion .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ set -x
# Install requirements of Linux
if [ $TRAVIS_OS_NAME == linux ]
then
sudo apt-get -y install debhelper devscripts build-essential g++ automake autoconf bison flex openjdk-7-jdk libboost-all-dev lsb-release libtool
# sudo apt-get -qq update # commenting out because i assume the apt-repository on travis is up to date
sudo apt-get -y install debhelper devscripts build-essential g++ automake autoconf bison flex openjdk-7-jdk libboost-all-dev lsb-release libtool
fi

############
Expand Down
4 changes: 2 additions & 2 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh -e
aclocal
#! /bin/sh -e
aclocal -I m4
autoheader
automake --gnu --add-missing
autoconf
6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
AC_INIT(souffle, m4_esyscmd([git describe --tags --abbrev=0 | tr -d '\n']), [[email protected]])
AC_PREREQ(2.68)
AC_COPYRIGHT(['2013-15 Oracle and/or its affiliates'])
AC_CONFIG_MACRO_DIRS([m4])

AC_CANONICAL_TARGET # target_cpu, target_vendor, and target_os
AC_CANONICAL_BUILD # build_cpu, build_vendor, and build_os
Expand Down Expand Up @@ -149,6 +148,9 @@ DIST_PACKAGING([bsd],[BSD_PACKAGE],[PKGBUILD],[pkgbuild])
dnl Enable pthread library
AC_CHECK_LIB(pthread, pthread_create,,
[AC_MSG_ERROR([required library pthread missing])])
AC_CHECK_HEADER(sqlite3.h,,[AC_MSG_ERROR([required library sqlite3 missing])])
AC_CHECK_LIB(sqlite3, sqlite3_open,,
[AC_MSG_ERROR([required library sqlite3 missing])])

dnl Enables OpenMP in the souffle compiler and interpreter
AC_OPENMP
Expand Down Expand Up @@ -178,6 +180,7 @@ AC_CONFIG_LINKS([include/souffle/IterUtils.h:src/IterUtils.h])
AC_CONFIG_LINKS([include/souffle/Util.h:src/Util.h])
AC_CONFIG_LINKS([include/souffle/RamLogger.h:src/RamLogger.h])
AC_CONFIG_LINKS([include/souffle/SymbolTable.h:src/SymbolTable.h])
AC_CONFIG_LINKS([include/souffle/SqliteRelationWriter.h:src/SqliteRelationWriter.h])
AC_CONFIG_LINKS([prof/souffle-profile:prof/souffle-profile])

AM_MISSING_PROG([AUTOM4TE], [autom4te])
Expand All @@ -187,7 +190,6 @@ AC_FUNC_ALLOCA
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h libintl.h limits.h malloc.h memory.h netdb.h stddef.h stdint.h stdlib.h string.h strings.h sys/time.h sys/timeb.h unistd.h wchar.h wctype.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
Expand Down
25 changes: 25 additions & 0 deletions licenses/DOOP-MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Portions of code that are modeled after the Doop framework
(http://doop.program-analysis.org/) in samples/ have the following copyright and permission notice:

Copyright (C) 2008-2009 Martin Bravenboer

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Empty file modified prof/souffle-profile
100644 → 100755
Empty file.
8 changes: 7 additions & 1 deletion prof/src/com/oracle/souffleprof/DataComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public int compare(Object[] a, Object[] b) {
String bStr = (String)b[5];
return Integer.valueOf(aStr.compareTo(bStr));
}},
ID {
public int compare(Object[] a, Object[] b) {
String aStr = (String)a[6];
String bStr = (String)b[6];
return Integer.valueOf(aStr.compareTo(bStr));
}},
PER {
public int compare(Object[] a, Object[] b) {
return Double.compare((Double)b[8], (Double)a[8]);
Expand All @@ -66,4 +72,4 @@ public int compare(Object[] o1, Object[] o2) {
}
};
}
}
}
98 changes: 54 additions & 44 deletions prof/src/com/oracle/souffleprof/ProgramRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ public Object[][] getRelTable() {
public Object[][] getRulTableGui() {
Map<String, Object[]> rule_map = new HashMap<String, Object[]>();



for (Relation rel : relation_map.values()) {
for (Rule rul : rel.getRuleMap().values()) {
Object[] temp = new Object[11];
Expand All @@ -212,8 +210,6 @@ public Object[][] getRulTableGui() {
temp[7] = rul.getLocator();
temp[9] = 0;
temp[10] = rel.getName();


rule_map.put(rul.getName(), temp);
}

Expand Down Expand Up @@ -243,10 +239,11 @@ public Object[][] getRulTableGui() {
}
for (Object[] t : rule_map.values()) {
if (((String) t[6]).charAt(0) == 'C') {

Long d2 = (Long) t[4];
Double rec_tup = d2.doubleValue();
t[3] = (tot_copy_time / (Double) tot_rec_tup) * rec_tup;
if (getTotNumRecTuples() != 0) {
t[3] = (getTotCopyTime() / getTotNumRecTuples()) * (Long) t[4];
} else {
t[3] = 0.0;
}
}
t[0] = (Double) t[1] + (Double) t[2] + (Double) t[3];

Expand Down Expand Up @@ -281,8 +278,6 @@ public Object[][] getRulTableGui() {
*/
public Object[][] getRulTable() {
Map<String, Object[]> rule_map = new HashMap<String, Object[]>();
tot_rec_tup = getTotNumRecTuples().doubleValue();
tot_copy_time = getTotCopyTime();

for (Relation rel : relation_map.values()) {
for (Rule rul : rel.getRuleMap().values()) {
Expand Down Expand Up @@ -322,13 +317,17 @@ public Object[][] getRulTable() {
rule_map.put(rul.getName(), temp);
}
}

for (Object[] t : rule_map.values()) {
if (((String) t[6]).charAt(0) == 'C') {
Long d2 = (Long) t[4];
Double rec_tup = d2.doubleValue();
t[3] = (tot_copy_time / (Double) tot_rec_tup) * rec_tup;
if (getTotNumRecTuples() != 0) {
t[3] = (getTotCopyTime() / getTotNumRecTuples()) * (Long) t[4];
} else {
t[3] = 0.0;
}
}
t[0] = (Double) t[1] + (Double) t[2] + (Double) t[3];

if ((Double)t[0] != 0.0) {
t[9] = (Double)((Long)t[4]/(Double)t[0]);
} else {
Expand Down Expand Up @@ -394,10 +393,12 @@ public Object[][] getVersionsGui(String strRel, String strRul) {
}
}
for (Object[] t : rule_map.values()) {
Double d = tot_rec_tup;
Long d2 = (Long) t[4];
Double d3 = d2.doubleValue();
t[3] = (tot_copy_time / (Double) d) * d3;
if (tot_rec_tup != 0) {
Double rec_tup = (Double) t[4];
t[3] = (tot_copy_time / tot_rec_tup) * rec_tup;
} else {
t[3] = 0.0;
}
t[0] = (Double) t[1] + (Double) t[2] + (Double) t[3];
if ((Double) t[0] != 0.0) {
t[9] = (Double) ((Long) t[4] / (Double) t[0]);
Expand Down Expand Up @@ -432,8 +433,6 @@ public Object[][] getVersionsGui(String strRel, String strRul) {
*/
public Object[][] getVersions(String strRel, String strRul) {
Map<String, Object[]> rule_map = new HashMap<String, Object[]>();
tot_rec_tup = getTotNumRecTuples().doubleValue();
tot_copy_time = getTotCopyTime();

for (Relation rel : relation_map.values()) {
if (rel.getId().equals(strRel)) {
Expand Down Expand Up @@ -468,10 +467,11 @@ public Object[][] getVersions(String strRel, String strRul) {
}
}
for (Object[] t : rule_map.values()) {
Double d = tot_rec_tup;
Long d2 = (Long) t[4];
Double d3 = d2.doubleValue();
t[3] = (tot_copy_time / (Double) d) * d3;
if (getTotNumRecTuples() != 0) {
t[3] = (getTotCopyTime() / getTotNumRecTuples()) * (Long) t[4];
} else {
t[3] = 0.0;
}
t[0] = (Double) t[1] + (Double) t[2] + (Double) t[3];
}
break;
Expand All @@ -497,35 +497,35 @@ public Relation getRelation(String name) {
return null;
}

public Object[][] formatTable(Object[][] table, int precision) {
Object[][] new_table = new Object[table.length][table[0].length];
public String[][] formatTable(Object[][] table, int precision) {
String[][] new_table = new String[table.length][table[0].length];
for (int i = 0; i < table.length; i++) {
for (int j = 0; j < table[0].length; j++) {
if (j<4 || j == table.length-2) {
if (table[i][j] instanceof Double) {
new_table[i][j] = formatTime((Double)table[i][j]);
} else if (j == 4) {
new_table[i][4] = formatNum(precision, (Long)table[i][4]);
} else if (table[i][j] instanceof Long) {
new_table[i][j] = formatNum(precision, (Long)table[i][j]);
} else if (table[i][j] != null) {
new_table[i][j] = table[i][j].toString();
} else {
new_table[i][j] = table[i][j];
new_table[i][j] = "-";
}
}
}
// for (Object[] row : new_table) {
// row[0] = run.formatTime((Double)row[0]);
// row[1] = run.formatTime((Double)row[1]);
// row[2] = run.formatTime((Double)row[2]);
// row[3] = run.formatTime((Double)row[3]);
// row[4] = run.formatNum(precision, (Long)row[4]);
// }
return new_table;
}

public String formatNum(int precision, Object number) {

Long amount;
if (number != null && number instanceof Long) {
amount = (Long) number;
} else {
return "0";
}
if (precision == -1) {
return ""+number;
return Long.toString(amount);
}
long amount = (Long) number;

String result;
DecimalFormat formatter;
if (amount >= 1000000000) {
Expand All @@ -551,8 +551,16 @@ public String formatNum(int precision, Object number) {
}

public String formatTime(Object number) {
Double time = null;
if (number instanceof Double) {
time = (Double) number;
}
if (time == null || time.isNaN()) {
return "-";
}

long val;
long sec = Math.round((Double) number);
long sec = Math.round(time);
if (sec >= 100) {
val = TimeUnit.SECONDS.toMinutes(sec);
if (val < 100) {
Expand All @@ -571,11 +579,13 @@ public String formatTime(Object number) {
return val + "D";
} else if (sec >= 10) {
return sec + "";
} else if (Double.compare((Double) number, 1.0) >= 0) {
DecimalFormat formatter = new DecimalFormat("0.0");
} else if (Double.compare(time, 1.0) >= 0) {
DecimalFormat formatter = new DecimalFormat("0.00");
return formatter.format(number);
} else if (Double.compare(time, 0.001) >= 0) {
DecimalFormat formatter = new DecimalFormat(".000");
return formatter.format(number);
}
DecimalFormat formatter = new DecimalFormat(".000");
return formatter.format(number);
return ".000";
}
}
Loading

0 comments on commit ae42e7b

Please sign in to comment.