示例#1
0
def test_get_default_energy_values_with_pkg_dram_rapl_api_two_sockets(fs_pkg_dram_two_socket):
    device = RaplDevice()
    device.configure()
    assert device.get_energy() == [fs_pkg_dram_two_socket.domains_current_energy['package_0'],
                                   fs_pkg_dram_two_socket.domains_current_energy['package_1'],
                                   fs_pkg_dram_two_socket.domains_current_energy['dram_0'],
                                   fs_pkg_dram_two_socket.domains_current_energy['dram_1']]
示例#2
0
def test_get_dram_energy_with_pkg_dram_rapl_api_return_correct_value(fs_pkg_dram_one_socket):
    """
    Create a RaplDevice instance on a machine with package and dram rapl api with on one socket
    configure it to monitor dram domain
    use the `get_energy` method and check if:
    - the returned list contains one element
    - this element is the power consumption of the dram on socket 0
    """
    device = RaplDevice()
    device.configure([RaplDramDomain(0)])
    assert device.get_energy() == [fs_pkg_dram_one_socket.domains_current_energy['dram_0']]
示例#3
0
def test_get_package0_and_all_dram_energy_with_pkg_dram_rapl_api_two_sockets_return_correct_value(fs_pkg_dram_two_socket):
    """
    Create a RaplDevice instance on a machine with package and dram rapl api with on two socket
    configure it to monitor package domains on socket 0 and dram domains on socket 0 and 1
    use the `get_energy` method and check if:
    - the returned list contains 3 elements
    - these elements are the power consumption of the package on socket 0 and dram on socket 0 and socket 1
    """
    device = RaplDevice()
    device.configure([RaplPackageDomain(0), RaplDramDomain(0), RaplDramDomain(1)])
    assert device.get_energy() == [fs_pkg_dram_two_socket.domains_current_energy['package_0'],
                                   fs_pkg_dram_two_socket.domains_current_energy['dram_0'],
                                   fs_pkg_dram_two_socket.domains_current_energy['dram_1']]
示例#4
0
def test_get_default_energy_values_with_pkg_rapl_api(fs_pkg_one_socket):
    device = RaplDevice()
    device.configure()
    assert device.get_energy() == [fs_pkg_one_socket.domains_current_energy['package_0']]