mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-23 05:29:53 +00:00
update benchmark
This commit is contained in:
parent
5b073dbe60
commit
8ae012ab77
@ -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
|
||||
|
||||
LIBNAME = capstone
|
||||
LIBNAME = ../../build/libcapstone.a
|
||||
|
||||
test_iter_benchmark: test_iter_benchmark.o
|
||||
${CC} $< -O3 -Wall -l$(LIBNAME) -o $@
|
||||
all: test_iter_benchmark test_file_benchmark
|
||||
|
||||
%.o: %.c
|
||||
${CC} -c -I../../include $< -o $@
|
||||
test_iter_benchmark: test_iter_benchmark.c
|
||||
${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:
|
||||
rm -rf *.o test_iter_benchmark
|
||||
rm -rf *.o test_iter_benchmark test_file_benchmark
|
||||
|
39
suite/benchmark/README.md
Normal file
39
suite/benchmark/README.md
Normal file
@ -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
|
BIN
suite/benchmark/test_file_benchmark
Executable file
BIN
suite/benchmark/test_file_benchmark
Executable file
Binary file not shown.
@ -89,7 +89,7 @@ static void test()
|
||||
cs_close(&handle);
|
||||
end = clock();
|
||||
timeUsed = (double)(end - start) / CLOCKS_PER_SEC;
|
||||
printf("time used:%f\n", timeUsed);
|
||||
printf("time used: %f s\n", timeUsed);
|
||||
}
|
||||
|
||||
int main()
|
||||
|
Loading…
Reference in New Issue
Block a user