From befc404f0b68858ac0dfb6e6bfa6bfc66b678735 Mon Sep 17 00:00:00 2001 From: Antonio Bellotta Date: Thu, 10 Aug 2023 15:17:28 +0200 Subject: [PATCH] Converted synstat script to use KB instead of MB --- _benchmarks/synstats.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/_benchmarks/synstats.py b/_benchmarks/synstats.py index a90039f0..d3ab81c4 100644 --- a/_benchmarks/synstats.py +++ b/_benchmarks/synstats.py @@ -7,13 +7,13 @@ def get_mem_usage(): """ - Return memory usage information in MB. + Return memory usage information in KB. """ with open("/proc/self/statm") as fd: _, data_size, _ = fd.read().split(maxsplit=2) - usage_mb = float(data_size) * os.sysconf("SC_PAGE_SIZE") / 1024 ** 2 + usage_kb = float(data_size) * os.sysconf("SC_PAGE_SIZE") / 1024 - return usage_mb + return usage_kb # Dummy class to pass to synapse objects @@ -42,23 +42,23 @@ def __getattr__(self, item): AMPA_helper = [h.AMPANMDAHelper(1, params_obj, 0.5, i, 0) for i in range(n_inst)] netcon_ampa = [pc.gid_connect(1000, helper.synapse) for helper in AMPA_helper] mem2 = get_mem_usage() -print('Memory usage per object ProbAMPA: %f KB' % ((mem2 - mem) / n_inst * 1024)) +print('Memory usage per object ProbAMPA: %f KB' % ((mem2 - mem) / n_inst)) h.load_file("GABAABHelper.hoc") mem = get_mem_usage() GABAAB_helper = [h.GABAABHelper(1, params_obj, 0.5, i, 0) for i in range(n_inst)] netcon_gabaab = [pc.gid_connect(1000, helper.synapse) for helper in GABAAB_helper] mem2 = get_mem_usage() -print('Memory usage per object ProbGABAAB: %f KB' % ((mem2 - mem) / n_inst * 1024)) +print('Memory usage per object ProbGABAAB: %f KB' % ((mem2 - mem) / n_inst)) h.load_file("GluSynapseHelper.hoc") mem = get_mem_usage() GluSynapse_helper = [h.GluSynapseHelper(1, params_obj, 0.5, i, 0, map_hoc) for i in range(n_inst)] netcon_glu = [pc.gid_connect(1000, helper.synapse) for helper in GluSynapse_helper] mem2 = get_mem_usage() -print('Memory usage per object GluSynapse: %f KB' % ((mem2 - mem) / n_inst * 1024)) +print('Memory usage per object GluSynapse: %f KB' % ((mem2 - mem) / n_inst)) mem = get_mem_usage() Gap_helper = [h.Gap(0.5) for i in range(n_inst)] mem2 = get_mem_usage() -print('Memory usage per object Gap: %f KB' % ((mem2 - mem) / n_inst * 1024)) +print('Memory usage per object Gap: %f KB' % ((mem2 - mem) / n_inst))