commit
21aceb7da5
|
@ -116,6 +116,7 @@ test_arm_regression
|
||||||
test_arm_regression.o
|
test_arm_regression.o
|
||||||
fuzz_harness
|
fuzz_harness
|
||||||
test_iter_benchmark
|
test_iter_benchmark
|
||||||
|
test_file_benchmark
|
||||||
fuzz_bindisasm
|
fuzz_bindisasm
|
||||||
fuzz_disasm
|
fuzz_disasm
|
||||||
fuzz_decode_platform
|
fuzz_decode_platform
|
||||||
|
@ -129,6 +130,3 @@ cstool/cstool
|
||||||
|
|
||||||
# android
|
# android
|
||||||
android-ndk-*
|
android-ndk-*
|
||||||
|
|
||||||
# benchmark/
|
|
||||||
benchmark/cs-benchmark*
|
|
|
@ -1,7 +0,0 @@
|
||||||
# Modified from https://github.com/athre0z/disas-bench
|
|
||||||
|
|
||||||
all:
|
|
||||||
cc main.c -O3 -o cs-benchmark -I../include ../build/libcapstone.a
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f cs-benchmark* *.o
|
|
|
@ -1,12 +1,17 @@
|
||||||
# Sample Makefile for Capstone Disassembly Engine
|
# Sample Makefile for Capstone Disassembly Engine
|
||||||
|
|
||||||
LIBNAME = capstone
|
LIBNAME = ../../build/libcapstone.a
|
||||||
|
|
||||||
test_iter_benchmark: test_iter_benchmark.o
|
all: test_iter_benchmark test_file_benchmark
|
||||||
${CC} $< -O3 -Wall -l$(LIBNAME) -o $@
|
|
||||||
|
|
||||||
%.o: %.c
|
test_iter_benchmark: test_iter_benchmark.c
|
||||||
${CC} -c -I../../include $< -o $@
|
${CC} $< -O3 -Wall -o $@ -I../../include $(LIBNAME)
|
||||||
|
|
||||||
|
test_file_benchmark: test_file_benchmark.c
|
||||||
|
${CC} $< -O3 -Wall -o $@ -I../../include $(LIBNAME)
|
||||||
|
|
||||||
|
# %.o: %.c
|
||||||
|
# ${CC} -c $< -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o test_iter_benchmark
|
rm -rf *.o test_iter_benchmark test_file_benchmark
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
# Benchmark
|
||||||
|
|
||||||
|
## Build capstone
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
|
||||||
|
#This last command is also where you can pass additional CMake configuration flags
|
||||||
|
#using `-D<key>=<value>`. Then to build use:
|
||||||
|
cmake --build . --config Release
|
||||||
|
cd ..
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build benchmark
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd suite/benchmark
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
## test_iter_benchmark
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./test_iter_benchmark
|
||||||
|
```
|
||||||
|
|
||||||
|
## test_file_benchmark
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./test_file_benchmark
|
||||||
|
```
|
||||||
|
The optional `test_file_benchmark` arguments are:
|
||||||
|
|
||||||
|
- `[loop-count]` = optional loop count. Total number of bytes decoded and formatted is `<code-len> * [loop-count]`
|
||||||
|
- `<code-offset>` = offset of the code section (in decimal or 0x hex)
|
||||||
|
- `<code-len>` = length of the code section (in decimal or 0x hex)
|
||||||
|
- `<filename>` = 64-bit x86 binary file to decode and format
|
|
@ -89,7 +89,7 @@ static void test()
|
||||||
cs_close(&handle);
|
cs_close(&handle);
|
||||||
end = clock();
|
end = clock();
|
||||||
timeUsed = (double)(end - start) / CLOCKS_PER_SEC;
|
timeUsed = (double)(end - start) / CLOCKS_PER_SEC;
|
||||||
printf("time used:%f\n", timeUsed);
|
printf("time used: %f s\n", timeUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
Loading…
Reference in New Issue