# 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")