Git Product home page Git Product logo

performancefuzzer's Introduction

PerformanceFuzzer

PerformanceFuzzer

https://pypi.org/project/PerformanceFuzzer/

Getting Started

$ git clone https://github.com/KKimj/PerformanceFuzzer
$ pip install PerformanceFuzzer

Prerequisites

$ sudo apt update && sudo apt upgrade
$ sudo apt-get install libgmp3-dev
$ pip3 install pytest
$ pip3 install pytest-benchmark
$ pip3 install pygal

Using virtualenv

$ pip3 install virtualenv
$ virtualenv venv
$ python3 -m virtualenv venv
$ source venv/bin/activate

$ pip3 install pytest
$ pip3 install pytest-benchmark
$ pip3 install pygal

$ deactivate

LLVM

# .c file to .ll
$ clang -S -emit-llvm {source_file.c} -o {target_file.ll}

# .ll file optimization & .ll file to .S file
$ opt -S -O2 -aa -basicaa -tbaa -licm {target_file.ll}

# .S file compile to executable file
$ clang {target_file.s} -o {target_file} {Clang_compile_option}

# optional : Dump executable file
$ objdump -D {target_file} > {target_file.dump}

# example from test.c
$ opt -S -O2 -aa -basicaa -tbaa -licm test.ll -o test_opt.ll && llc test_opt.ll -o test.s && clang test.s -o test  -fopenmp=libiomp5 -lgmp -lssl -lcrypto

Running the tests

$ sudo python3 main.py cpubench cpubench --round=8 --warmup=2 --cpubench=50000
# same as
$ sudo python3 main.py cpubench cpubench -r 8 -w 2 -cpu 50000

$ python3 -m pytest main.py --benchmark-histogram
$ ./run.sh cpubench
$ sudo ./tests/cpubench 50000 --singlethreaded --printdigits

Examples

Alt text

Alt text

Acknowledgments

https://github.com/theblixguy/CPUBench

https://pypi.org/project/pytest-benchmark/

performancefuzzer's People

Contributors

kkimj avatar

Stargazers

 avatar  avatar

Watchers

 avatar

performancefuzzer's Issues

HelloWorld code

clang -S -emit-llvm ./tests/helloworld/main.c -o ./test/helloworld/main.ll

opt -S -O2 -aa -basicaa -tbaa -licm ./tests/helloworld/main.ll -o ./tests/helloworld/main.ll

llc ./tests/helloworld/main.ll -o ./tests/helloworld/main.s

clang ./tests/helloworld/main.s -o ./tests/helloworld/main

main.py, CLI : option argument handling

def get_arguments():
    parser = argparse.ArgumentParser()
    parser.add_argument(nargs='+' ,help='Example) index.html', dest='filename')
    parser.add_argument('--optional', '-o', nargs='*', help='Example) save', default=[], dest='option')

    filename_list = parser.parse_args().filename
    option_list = parser.parse_args().option

    return filename_list, option_list

(benchmark) round와 warmup을 옵션으로 지정하는 것을 구현한다.

PHI nodes not grouped at top of basic block!

image

실행문

llc ./tests/cpubench/cpubench500_opt_fuzzer.ll

에러메세지

PHI nodes not grouped at top of basic block!
  %11 = phi i32 [ 0, %4 ], [ %9, %5 ]
label %10
llc: ./tests/cpubench/cpubench500_opt_fuzzer.ll: error: input module is broken!

[meeting] 2021-03-22

min -> avg

min value can be affected by the background service.

o3 vs -04

Check gcc cache optimization

clock option

cpu clock speed set constant NOT to be variable

afl, mutation policy

reference afl's mutation logic

input coverage

So that it doesn't apply only to certain situations.

benchmark model & controller

 Performance counter stats for './tests/cpubench/cpubench 50000 --singlethreaded --printdigits' (2 runs):

          4,340.20 msec task-clock                #    0.998 CPUs utilized            ( +-  0.57% )
                32      context-switches          #    0.007 K/sec                    ( +- 10.77% )
                16      cpu-migrations            #    0.004 K/sec                    ( +-  3.03% )
               393      page-faults               #    0.091 K/sec                    ( +-  1.02% )
    21,042,138,266      cycles                    #    4.848 GHz                      ( +-  0.04% )
    53,506,630,089      instructions              #    2.54  insn per cycle           ( +-  0.00% )
     2,977,691,044      branches                  #  686.073 M/sec                    ( +-  0.03% )
        68,304,710      branch-misses             #    2.29% of all branches          ( +-  0.01% )

            4.3479 +- 0.0323 seconds time elapsed  ( +-  0.74% )

parallel

  • parse and build IR file
  • running bench

[meeting] 2021-04-05

  1. alloca with IR code parsing
  2. Stack & Data memory check with GDB
  3. time measure with cpu clock
  4. parallel programming
  5. Code convention improve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.