First commit, Vystem v0.1
This commit is contained in:
43
shelter/tools/generator/malloc_payload_gen.py
Normal file
43
shelter/tools/generator/malloc_payload_gen.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
import random
|
||||
print("// SPDX-License-Identifier: MPL-2.0\n// This file contain the values to use as alloc size for the benchmark of sh_malloc and sh_free\n// It's autogenerated by tools/generator/malloc_payload_gen.py\n// Copy the output of this script in this file to regenerate it.")
|
||||
print("#ifndef SH_LIB_PAYLOADS_TEST_MALLOC\n#define SH_LIB_PAYLOADS_TEST_MALLOC\n#include \"std/type.h\"")
|
||||
print("__attribute__((section(\".data\"))) sh_uint32 test_malloc_small_size[10000]={",end="")
|
||||
out=[]
|
||||
lambd=0.006
|
||||
while len(out)<10000:
|
||||
val=int(random.expovariate(lambd))+2
|
||||
if val<=1024:
|
||||
out.append(val)
|
||||
random.shuffle(out)
|
||||
for i in range(len(out)):
|
||||
print(out[i],end="")
|
||||
if i!=(len(out)-1):
|
||||
print(",",end="")
|
||||
print("};")
|
||||
print("__attribute__((section(\".data\"))) sh_uint32 test_malloc_big_size[1000]={",end="")
|
||||
out=[]
|
||||
lambd=0.006
|
||||
while len(out)<1000:
|
||||
val=int(random.expovariate(lambd))+2
|
||||
if val<=25:
|
||||
out.append(val)
|
||||
random.shuffle(out)
|
||||
for i in range(len(out)):
|
||||
print(out[i],end="")
|
||||
if i!=(len(out)-1):
|
||||
print(",",end="")
|
||||
print("};")
|
||||
print("__attribute__((section(\".data\"))) sh_uint16 test_malloc_big_alloc[2000]={",end="")
|
||||
out=[]
|
||||
for i in range(0,1000):
|
||||
out.append(i)
|
||||
for i in range(0,1000):
|
||||
out.append(i)
|
||||
random.shuffle(out)
|
||||
for i in range(len(out)):
|
||||
print(out[i],end="")
|
||||
if i!=(len(out)-1):
|
||||
print(",",end="")
|
||||
print("};")
|
||||
print("#endif")
|
||||
34
shelter/tools/generator/pez_alloc_free_payload_gen.py
Normal file
34
shelter/tools/generator/pez_alloc_free_payload_gen.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
import random
|
||||
print("// SPDX-License-Identifier: MPL-2.0\n// This file contain the values to use as pages count for the benchmark of allocs and free with Pez\n// It's autogenerated by tools/generator/pez_alloc_free_payload_gen.py\n// Copy the output of this script in this file to regenerate it.")
|
||||
print("#ifndef SH_LIB_PAYLOADS_TEST_PEZ\n#define SH_LIB_PAYLOADS_TEST_PEZ\n#include \"std/type.h\"")
|
||||
print("__attribute__((section(\".data\"))) sh_uint64 test_pez_physical_size[2000]={",end="")
|
||||
out=[]
|
||||
for i in range(1000):
|
||||
out.append(1)
|
||||
rand_list=[]
|
||||
lambd=0.006
|
||||
while len(rand_list)<1000:
|
||||
val=int(random.expovariate(lambd))+2
|
||||
if val<=1000:
|
||||
rand_list.append(val)
|
||||
out=out+rand_list
|
||||
random.shuffle(out)
|
||||
for i in range(len(out)):
|
||||
print(out[i],end="")
|
||||
if i!=(len(out)-1):
|
||||
print(",",end="")
|
||||
print("};")
|
||||
print("__attribute__((section(\".data\"))) sh_uint64 test_pez_physical_alloc[4000]={",end="")
|
||||
out=[]
|
||||
for i in range(0,2000):
|
||||
out.append(i)
|
||||
for i in range(0,2000):
|
||||
out.append(i)
|
||||
random.shuffle(out)
|
||||
for i in range(len(out)):
|
||||
print(out[i],end="")
|
||||
if i!=(len(out)-1):
|
||||
print(",",end="")
|
||||
print("};")
|
||||
print("#endif")
|
||||
18
shelter/tools/generator/radix_tree_payload_gen.py
Normal file
18
shelter/tools/generator/radix_tree_payload_gen.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
import random
|
||||
print("// SPDX-License-Identifier: MPL-2.0\n// This file contain the values to use as keys, values and search for the benchmarks of the radix trees subsystem\n// It's autogenerated by tools/generator/radix_tree_payload_gen.py\n// Copy the output of this script in this file to regenerate it.")
|
||||
print("#ifndef SH_LIB_PAYLOADS_TEST_RADIX\n#define SH_LIB_PAYLOADS_TEST_RADIX\n#include \"std/type.h\"")
|
||||
hex_char=["1","2","3","4","5","6","7","8","9","0","A","B","C","D","E","F"];
|
||||
def randlist(num:int,hex_char_num:int,name:str):
|
||||
print("__attribute__((section(\".data\"))) sh_uint64 "+name+"["+str(num)+"]={",end="")
|
||||
for i in range(num):
|
||||
print("0x",end="")
|
||||
for y in range(hex_char_num):
|
||||
print(hex_char[random.randint(0,15)],end="")
|
||||
if i!=(num-1):
|
||||
print(",",end="")
|
||||
print("};")
|
||||
randlist(10000,16,"test_keys")
|
||||
randlist(10000,16,"test_values")
|
||||
randlist(10000,16,"test_search")
|
||||
print("#endif")
|
||||
Reference in New Issue
Block a user