# Path: hardware/benchmark/mem.py
# def get_available_memory():
# def check_mem_size(block_size, cpu_count):
# def run_sysbench_memory_threaded(hw_lst, max_time, block_size, cpu_count,
#                                  processor_num=None):
# def run_sysbench_memory_forked(hw_lst, max_time, block_size, cpu_count):
# def mem_perf(hw_lst, max_time=5):
# 
# Path: hardware/benchmark/utils.py
# def get_value(hw_lst, level1, level2, level3):
# def get_one_cpu_per_socket(hw_lst):


import subprocess
import unittest
from unittest import mock
from hardware.benchmark import mem
from hardware.benchmark import utils
#    under the License.




SYSBENCH_OUTPUT = """Operations performed: 1957354 (391412.04 ops/sec)

1911.48 MB transferred (382.24 MB/sec)


Test execution summary:
    total time:                          5.0008s
    total number of events:              1957354
    total time taken by event execution: 3.0686
    per-request statistics:
         min:                                  0.00ms
         avg:                                  0.00ms
         max:                                  0.23ms
         approx.  95 percentile:               0.00ms

Threads fairness:
    events (avg/stddev):           1957354.0000/0.00
    execution time (avg/stddev):   3.0686/0.00"""

EXPECTED_RESULT = [
    ('cpu', 'logical', 'number', 2),
    ('cpu', 'physical', 'number', 2),
    ('cpu', 'logical_0', 'bandwidth_1K', '382'),
    ('cpu', 'logical_0', 'bandwidth_4K', '382'),
    ('cpu', 'logical_0', 'bandwidth_1M', '382'),

# Path: hardware/benchmark/mem.py
# def get_available_memory():
# def check_mem_size(block_size, cpu_count):
# def run_sysbench_memory_threaded(hw_lst, max_time, block_size, cpu_count,
#                                  processor_num=None):
# def run_sysbench_memory_forked(hw_lst, max_time, block_size, cpu_count):
# def mem_perf(hw_lst, max_time=5):
# 
# Path: hardware/benchmark/utils.py
# def get_value(hw_lst, level1, level2, level3):
# def get_one_cpu_per_socket(hw_lst):


# Path: hardware/tests/test_benchmark_mem.py
import subprocess
import unittest
from unittest import mock
from hardware.benchmark import mem
from hardware.benchmark import utils

#    under the License.




SYSBENCH_OUTPUT = """Operations performed: 1957354 (391412.04 ops/sec)

1911.48 MB transferred (382.24 MB/sec)


Test execution summary:
    total time:                          5.0008s
    total number of events:              1957354
    total time taken by event execution: 3.0686
    per-request statistics:
         min:                                  0.00ms
         avg:                                  0.00ms
         max:                                  0.23ms
         approx.  95 percentile:               0.00ms

Threads fairness:
    events (avg/stddev):           1957354.0000/0.00
    execution time (avg/stddev):   3.0686/0.00"""

EXPECTED_RESULT = [
    ('cpu', 'logical', 'number', 2),
    ('cpu', 'physical', 'number', 2),
    ('cpu', 'logical_0', 'bandwidth_1K', '382'),
    ('cpu', 'logical_0', 'bandwidth_4K', '382'),
    ('cpu', 'logical_0', 'bandwidth_1M', '382'),

    ('cpu', 'logical_0', 'bandwidth_16M', '382'),