Rizin
unix-like reverse engineering framework and cli tools
benchmark Namespace Reference

Functions

def to_hex (s)
 
def get_code (f, size)
 
def cs (md, code)
 
def cs_lite (md, code)
 

Variables

string FILE = '/usr/bin/python'
 
tuple all_tests
 
 cfile = open(FILE)
 
 request = sys.argv[1]
 
 md = Cs(arch, mode)
 
 syntax
 
def code = get_code(cfile, 128)
 
int c_t = 0
 
 t1 = time()
 

Function Documentation

◆ cs()

def benchmark.cs (   md,
  code 
)

Definition at line 57 of file benchmark.py.

57 def cs(md, code):
58  insns = md.disasm(code, 0)
59  # uncomment below line to speed up this function 200 times!
60  # return
61  for i in insns:
62  if i.address == 0x100000:
63  print i
64 
65 
def cs(md, code)
Definition: benchmark.py:57

◆ cs_lite()

def benchmark.cs_lite (   md,
  code 
)

Definition at line 66 of file benchmark.py.

66 def cs_lite(md, code):
67  insns = md.disasm_lite(code, 0)
68  for (addr, size, mnem, ops) in insns:
69  if addr == 0x100000:
70  print i
71 
72 
def cs_lite(md, code)
Definition: benchmark.py:66

◆ get_code()

def benchmark.get_code (   f,
  size 
)

Definition at line 47 of file benchmark.py.

47 def get_code(f, size):
48  code = f.read(size)
49  if len(code) != size: # reached end-of-file?
50  # then reset file position to begin-of-file
51  f.seek(0)
52  code = f.read(size)
53 
54  return code
55 
56 
size_t len
Definition: 6502dis.c:15
def get_code(f, size)
Definition: benchmark.py:47

References len.

◆ to_hex()

def benchmark.to_hex (   s)

Definition at line 44 of file benchmark.py.

44 def to_hex(s):
45  return " ".join("0x" + "{0:x}".format(ord(c)).zfill(2) for c in s) # <-- Python 3 is OK
46 
def to_hex(s)
Definition: benchmark.py:44

Variable Documentation

◆ all_tests

tuple benchmark.all_tests
Initial value:
1 = (
2  (CS_ARCH_X86, CS_MODE_16, "X86-16 (Intel syntax)", 0),
3  (CS_ARCH_X86, CS_MODE_32, "X86-32 (ATT syntax)", CS_OPT_SYNTAX_ATT),
4  (CS_ARCH_X86, CS_MODE_32, "X86-32 (Intel syntax)", 0),
5  (CS_ARCH_X86, CS_MODE_64, "X86-64 (Intel syntax)", 0),
6  (CS_ARCH_ARM, CS_MODE_ARM, "ARM", 0),
7  (CS_ARCH_ARM, CS_MODE_THUMB, "THUMB (ARM)", 0),
8  (CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN, "MIPS-32 (Big-endian)", 0),
9  (CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_LITTLE_ENDIAN, "MIPS-64-EL (Little-endian)", 0),
10  (CS_ARCH_ARM64, CS_MODE_ARM, "ARM-64 (AArch64)", 0),
11  (CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, "PPC", 0),
12  (CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, "PPC, print register with number only", CS_OPT_SYNTAX_NOREGNAME),
13  (CS_ARCH_SPARC, CS_MODE_BIG_ENDIAN, "Sparc", 0),
14  (CS_ARCH_SYSZ, 0, "SystemZ", 0),
15  (CS_ARCH_XCORE, 0, "XCore", 0),
16  (CS_ARCH_M68K, 0, "M68K", 0),
17  )

Definition at line 24 of file benchmark.py.

◆ c_t

int benchmark.c_t = 0

Definition at line 101 of file benchmark.py.

◆ cfile

◆ code

def benchmark.code ( void  ) = get_code(cfile, 128)

Definition at line 95 of file benchmark.py.

◆ FILE

string benchmark.FILE = '/usr/bin/python'

Definition at line 21 of file benchmark.py.

Referenced by __write(), _zip_fopen_close_on_exec(), _zip_stdio_op_close(), _zip_stdio_op_read(), _zip_stdio_op_seek(), _zip_stdio_op_stat(), _zip_stdio_op_tell(), _zip_stdio_op_write(), add_download(), BMK_benchFiles(), BMK_loadFiles(), buffer_from_file(), buffer_to_file(), check_exist_file(), clusterLoadConfig(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), do_extract_currentfile(), download_and_write(), fclose_file_func(), ferror_file_func(), file_create(), file_exists(), fopen64_file_func(), fopen_file_func(), fread_file_func(), fseek64_file_func(), fseek_file_func(), ftell64_file_func(), ftell_file_func(), fullSpeedBench(), fwrite_file_func(), get_data(), getFileCrc(), ihex_write(), isLargeFile(), load(), load_1(), loadFile(), log_log(), LZ4IO_compressFilename_extRess(), LZ4IO_compressFilename_Legacy(), LZ4IO_createDict(), LZ4IO_decompressDstFile(), LZ4IO_decompressSrcFile(), LZ4IO_getCompressedFileInfo(), LZ4IO_openDstFile(), LZ4IO_openSrcFile(), main(), mpc_parse_contents(), mpca_lang_contents(), pids_sons_of_r(), print_filename(), print_insn_lanai(), print_insn_sparc(), read_cpufreq(), read_models(), read_to_memory(), ReadFileMemory(), rip(), rz_cmd_cmp_file_handler(), rz_cons_flush(), rz_core_cmd_foreach(), rz_core_dump(), rz_file_dump(), rz_file_hexdump(), rz_file_slurp(), rz_file_slurp_hexpairs(), rz_file_slurp_range(), rz_line_hist_load(), rz_line_hist_save(), rz_run_parseline(), rz_save_panels_layout(), rz_sys_fopen(), rz_vlog(), spp_file(), TAG_CALLBACK(), tar(), unzRepair(), usage(), use_data(), uv__open_file(), uv_cpu_info(), write_memory_src_to_file(), and zip_fdopen().

◆ md

◆ request

benchmark.request = sys.argv[1]

Definition at line 77 of file benchmark.py.

◆ syntax

benchmark.syntax

◆ t1