Benchmarks

This commit is contained in:
Artur Meski
2018-07-22 14:12:14 +01:00
parent 36b5e7b741
commit 5edab04266
2 changed files with 31 additions and 13 deletions

View File

@@ -33,18 +33,17 @@ context-automaton {{
""" """
PROPERTY_STR = """ PROPERTY_STR = """
rsctlk-property {{ default : {:s} }} rsctlk-property {{ {:s} : {:s} }}
""" """
################################################################# #################################################################
if len(argv) < 2: if len(argv) < 1:
print("Usage: {:s} <number of processes> <property number>".format(argv[0])) print("Usage: {:s} <number of processes>".format(argv[0]))
exit(100) exit(100)
n = int(argv[1]) n = int(argv[1])
f = int(argv[2])
assert n > 1, "number of proc must be > 1" assert n > 1, "number of proc must be > 1"
@@ -72,15 +71,19 @@ for i in range(n):
out += CA_STR.format(transitions) out += CA_STR.format(transitions)
if f == 1: # f1
formula = "EF( proc0.in )"
for i in range(1, n):
formula += " AND EF( proc{:d}.in )".format(i)
out += PROPERTY_STR.format("f1",formula)
# f2
subf = "~proc1.in" subf = "~proc1.in"
for i in range(2, n): for i in range(2, n):
subf += " AND ~proc{:d}.in".format(i) subf += " AND ~proc{:d}.in".format(i)
formula = "AG( proc0.in IMPLIES K[proc0]({:s}) )".format(subf) formula = "AG( proc0.in IMPLIES K[proc0]({:s}) )".format(subf)
else:
assert False, "No such formula"
out += PROPERTY_STR.format(formula) out += PROPERTY_STR.format("f2",formula)
print(out) print(out)

View File

@@ -21,6 +21,9 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#if defined(__APPLE__)
#include <malloc/malloc.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include "macro.hh" #include "macro.hh"
@@ -62,9 +65,21 @@ static inline int64 memUsedInt64()
return (int64)memReadStat() * (int64)getpagesize(); return (int64)memReadStat() * (int64)getpagesize();
} }
#if defined(__APPLE__)
static inline double memUsed() {
malloc_statistics_t t;
malloc_zone_statistics(NULL, &t);
return (double)t.max_size_in_use / (1024*1024); }
#else
static inline double memUsed() static inline double memUsed()
{ {
return memUsedInt64() / 1048576.0; return memUsedInt64() / (1024*1024);
} }
#endif #endif
#endif