Example #1
0
def getStats(datapoint, date=False, duration="day"):
    if not date:
        date = timestamp.now()
    if duration == 'day':
        date = date.replace(hour=0, minute=0, second=0, microsecond=0)
    elif duration == 'hour':
        date = date.replace(minute=0, second=0, microsecond=0)
    else:
        return
    stats = memcache.get("stats_%s_%s_%s" % (datapoint, date, duration))
    if stats == None:
        stats = (StatsData.all().filter("datapoint =", datapoint)
            .filter("date =", date).filter("duration =", duration).get())
        if stats == None:
            stats = StatsData(datapoint=datapoint, date=date, count=0,
                    duration=duration)
            if datapoint == 'quota':
                stats.count = getQuota().amount
            stats.put()
        else:
            memcache.set("stats_%s_%s_%s" % (datapoint, date, duration),
                    stats)
    return stats
Example #2
0
def getStats(datapoint, date=False, duration="day"):
    if not date:
        date = timestamp.now()
    if duration == 'day':
        date = date.replace(hour=0, minute=0, second=0, microsecond=0)
    elif duration == 'hour':
        date = date.replace(minute=0, second=0, microsecond=0)
    else:
        return
    stats = memcache.get("stats_%s_%s_%s" % (datapoint, date, duration))
    if stats == None:
        stats = (StatsData.all().filter("datapoint =", datapoint).filter(
            "date =", date).filter("duration =", duration).get())
        if stats == None:
            stats = StatsData(datapoint=datapoint,
                              date=date,
                              count=0,
                              duration=duration)
            if datapoint == 'quota':
                stats.count = getQuota().amount
            stats.put()
        else:
            memcache.set("stats_%s_%s_%s" % (datapoint, date, duration), stats)
    return stats
Example #3
0
def stat (key, val): stats.put (key, val)
def main (argv):
Example #4
0
File: inc.py Project: alx441/XSHM
def stat(key, val):
    stats.put(key, val)
Example #5
0
def main(argv):
    args = parseArgs(argv[1:])
    stat('Result', 'UNKNOWN')
    z3.set_option(verbose=args.verbose)
    ctx = z3.Context()
    fp = z3.Fixedpoint(ctx=ctx)

    if not args.slice:
        print 'No slicing'
        fp.set(slice=False)

    if not args.inline:
        print 'No inlining'
        fp.set(inline_linear=False)
        fp.set(inline_eager=False)

    print 'Engine: ', args.engine

    fp.set(validate_result=args.validate)
    fp.set(engine=args.engine, use_farkas=True, generate_proof_trace=False)
    fp.set(use_utvpi=args.use_utvpi)
    fp.set(eager_reach_check=args.eager_reach_check)
    fp.set(validate_theory_core=args.validate_theory_core)
    fp.set(print_statistics=args.print_stats)
    fp.set(bit_blast=args.bit_blast)

    if args.dfs: fp.set(bfs_model_search=False)

    fp.set(order_children=int(args.order_children))

    if args.array_blast:
        fp.set(array_blast=True)

    if args.array_blast_full:
        fp.set(array_blast_full=True)

    if args.use_heavy_mev:
        fp.set(use_heavy_mev=True)

    with stats.timer('Parse'):
        q = fp.parse_file(args.file)

    if len(args.trace) > 0:
        print 'Enable trace: ',
        for t in args.trace.split(':'):
            print t,
            z3.enable_trace(t)
        print
        stats.put('Trace', args.trace)
    #print fp
    with stats.timer('Query'):
        res = fp.query_from_lvl(args.from_lvl, q[0])

    if res == z3.sat: stat('Result', 'CEX')
    elif res == z3.unsat: stat('Result', 'SAFE')

    if args.answer:
        print 'The answer is:'
        print fp.get_answer()

    if res == z3.sat:
        if args.ground_answer:
            print 'A ground answer:'
            print fp.get_ground_sat_answer()
        if args.rules_along_trace:
            print 'Rules along trace:'
            print fp.get_rules_along_trace()
Example #6
0
def stat (key, val): stats.put (key, val)

def seaTerm(smt_file, rank_function):
Example #7
0
def stat (key, val): stats.put (key, val)
def main (argv):
Example #8
0
 def stat(self, key, val):
     stats.put(key, val)
Example #9
0
    def stat (self, key, val): stats.put (key, val)

    def processFile(self, result):
Example #10
0
def main (argv):
    args = parseArgs (argv[1:])
    stat ('Result', 'UNKNOWN')

    z3_args = which ('z3')

    if z3_args is None:
        print 'No executable named "z3" found in current directory or PATH'
        return

    z3_args += ' -v:' + str(args.verbose)

    if not args.slice:
        print 'No slicing'
        z3_args += ' fixedpoint.slice=false'

    if not args.inline:
        print 'No inlining'
        z3_args += ' fixedpoint.inline_linear=false'
        z3_args += ' fixedpoint.inline_eager=false'

    print 'Engine: ', args.engine

    if (args.validate):
        z3_args += ' fixedpoint.validate_result=true'

    if (args.answer):
        z3_args += ' fixedpoint.print_answer=true'

    z3_args += ' fixedpoint.engine='
    z3_args += args.engine

    if args.no_utvpi:
        z3_args += ' fixedpoint.use_utvpi=false'

    if args.lazy_reach_check:
        z3_args += ' fixedpoint.eager_reach_check=false'

    if args.validate_theory_core:
        z3_args += ' fixedpoint.validate_theory_core=true'

    if args.print_stats:
        z3_args += ' fixedpoint.print_statistics=true'

    if args.dfs:
        z3_args += ' fixedpoint.bfs_model_search=false'

    if int(args.order_children)==1:
        z3_args += ' fixedpoint.order_children=1'

    if args.array_blast:
        z3_args += ' fixedpoint.array_blast=true'

    if args.array_blast_full:
        z3_args += ' fixedpoint.array_blast_full=true'

    if args.use_heavy_mev:
        z3_args += ' fixedpoint.use_heavy_mev=true'

    if args.flexible_trace:
        z3_args += ' fixedpoint.flexible_trace=true'

    z3_args += ' ' + args.file


    if len(args.trace) > 0:
        print 'Enable trace: ',
        for t in args.trace.split (':'):
            print t,
            z3_args += ' -tr:{}'.format (t)
        print 
        stats.put ('Trace', args.trace)

    print z3_args

    with stats.timer ('Query'):
        popen = subprocess.Popen(z3_args.split (), stdout=subprocess.PIPE)
        popen.wait()
        res = popen.stdout.read()
    if 'unsat' in res:
        res = 'unsat'
    elif 'sat' in res:
        res = 'sat'
    else:
        res = 'unknown'
    print 'Result:', res

    if res == 'sat':
        if args.smt2lib: stat ('Result', 'SAFE')
        else: stat ('Result', 'CEX')
    elif res == 'unsat':
        if args.smt2lib: stat ('Result', 'CEX')
        else: stat ('Result', 'SAFE')
Example #11
0
def stat (key, val): stats.put (key, val)

import os.path
Example #12
0
def stat (key, val): stats.put (key, val)

class Inc(object):
Example #13
0
def stat (key, val): bench_stats.put (key, val)

def compile(prog, build_dir):
Example #14
0
def stat(key, val):
    bench_stats.put(key, val)
Example #15
0
def compute_z3_args(args):
    z3_args = which('z3')

    if args.jobsize != -1:
        z3_args += ' %d' % int(args.jobsize)

    if z3_args is None:
        print 'No executable named "z3" found in current directory or PATH'
        return

    z3_args += ' -v:' + str(args.verbose)

    if not args.slice:
        print 'No slicing'
        z3_args += ' fixedpoint.xform.slice=false'

    if not args.inline:
        print 'No inlining'
        z3_args += ' fixedpoint.xform.inline_linear=false'
        z3_args += ' fixedpoint.xform.inline_eager=false'

    print 'Engine: ', args.engine

    if args.pve:
        z3_args += ' fixedpoint.xform.tail_simplifier_pve=true'
    else:
        z3_args += ' fixedpoint.xform.tail_simplifier_pve=false'

    if (args.validate):
        z3_args += ' fixedpoint.pdr.validate_result=true'

    if (args.answer):
        z3_args += ' fixedpoint.print.answer=true'

    z3_args += ' fixedpoint.engine='
    z3_args += args.engine

    if args.no_utvpi:
        z3_args += ' fixedpoint.pdr.utvpi=false'

    if args.lazy_reach_check:
        z3_args += ' fixedpoint.eager_reach_check=false'

    if args.validate_theory_core:
        z3_args += ' fixedpoint.validate_theory_core=true'

    if args.print_stats:
        z3_args += ' fixedpoint.print_statistics=true'

    if args.dfs:
        z3_args += ' fixedpoint.pdr.bfs_model_search=false'

    if int(args.order_children) == 1:
        z3_args += ' fixedpoint.order_children=1'

    if args.array_blast:
        z3_args += ' fixedpoint.xform.array_blast=true'

    if args.array_blast_full:
        z3_args += ' fixedpoint.xform.array_blast_full=true'

    if args.use_heavy_mev:
        z3_args += ' fixedpoint.use_heavy_mev=true'

    if args.flexible_trace:
        z3_args += ' fixedpoint.pdr.flexible_trace=true'

    if args.skip_propagate:
        z3_args += ' fixedpoint.pdr.skip_propagate=true'

    if args.keep_obligations:
        z3_args += ' fixedpoint.reset_obligation_queue=false'

    if int(args.max_lvl) >= 0:
        z3_args += ' fixedpoint.pdr.max_level={}'.format(args.max_lvl)

    if args.elim_aux:
        z3_args += ' fixedpoint.spacer.elim_aux=true'
    else:
        z3_args += ' fixedpoint.spacer.elim_aux=false'

    if args.reach_dnf:
        z3_args += ' fixedpoint.spacer.reach_dnf=true'
    else:
        z3_args += ' fixedpoint.spacer.reach_dnf=false'

    if args.distprofile:
        z3_args += ' -profile:%s' % args.distprofile

    if args.gasnet_spawnfn:
        os.environ['GASNET_SPAWNFN'] = args.gasnet_spawnfn

    if (args.verify_msgs):
        z3_args += ' fixedpoint.gasnet.verify_msgs=true'

    if args.restart > -1:
        z3_args += ' fixedpoint.pmuz.node_work_budget=%d' % args.restart
        z3_args += ' fixedpoint.pmuz.node_restarts=true'

    z3_args += ' ' + args.file

    if len(args.trace) > 0:
        print 'Enable trace: ',
        for t in args.trace.split(':'):
            print t,
            z3_args += ' -tr:{}'.format(t)
        print
        stats.put('Trace', args.trace)

    return z3_args
Example #16
0
 def stat(key, val): stats.put(key, val)
 os.setpgrp()