First commit, Vystem v0.1
This commit is contained in:
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")
|
||||
Reference in New Issue
Block a user