How to use the powerapi.dispatch_rule.HWPCDispatchRule function in powerapi

To help you get started, we’ve selected a few powerapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github powerapi-ng / powerapi / tests / unit / dispatcher_rule / test_hwpc_dispatch_rule.py View on Github external
def test_init_fields_name_test():
    """
    test if the field's names of the dispatch_rule identifier tuple are
    correctly initialized
    """
    assert HWPCDispatchRule(HWPCDepthLevel.TARGET).fields == ['target']
    assert HWPCDispatchRule(HWPCDepthLevel.ROOT).fields == ['sensor']
    assert HWPCDispatchRule(HWPCDepthLevel.SOCKET).fields == ['sensor',
                                                              'socket']
    assert HWPCDispatchRule(HWPCDepthLevel.CORE).fields == ['sensor', 'socket',
                                                            'core']
github powerapi-ng / powerapi / tests / unit / dispatcher_rule / test_hwpc_dispatch_rule.py View on Github external
def test_init_fields_name_test():
    """
    test if the field's names of the dispatch_rule identifier tuple are
    correctly initialized
    """
    assert HWPCDispatchRule(HWPCDepthLevel.TARGET).fields == ['target']
    assert HWPCDispatchRule(HWPCDepthLevel.ROOT).fields == ['sensor']
    assert HWPCDispatchRule(HWPCDepthLevel.SOCKET).fields == ['sensor',
                                                              'socket']
    assert HWPCDispatchRule(HWPCDepthLevel.CORE).fields == ['sensor', 'socket',
                                                            'core']
github powerapi-ng / powerapi / tests / unit / dispatcher_rule / test_hwpc_dispatcher_rule.py View on Github external
def test_init_fields_name_test():
    """
    test if the field's names of the dispatch_rule identifier tuple are
    correctly initialized
    """
    assert HWPCDispatchRule(HWPCDepthLevel.TARGET).fields == ['target']
    assert HWPCDispatchRule(HWPCDepthLevel.ROOT).fields == ['sensor']
    assert HWPCDispatchRule(HWPCDepthLevel.SOCKET).fields == ['sensor',
                                                              'socket']
    assert HWPCDispatchRule(HWPCDepthLevel.CORE).fields == ['sensor', 'socket',
                                                            'core']
github powerapi-ng / powerapi / tests / integration / dispatcher / test_integration_dispatcher.py View on Github external
def route_table_hwpc_not_primary():
    """
    return a RouteTable with :
      - a FakeGBR as primary rule
      - a HWPCGrouptBy rule
    """
    route_table = RouteTable()
    route_table.dispatch_rule(FakeReport, FakeGBR(primary=True))
    route_table.dispatch_rule(HWPCReport, HWPCDispatchRule(HWPCDepthLevel.ROOT))

    return route_table
github powerapi-ng / powerapi / tests / unit / dispatcher_rule / test_hwpc_dispatcher_rule.py View on Github external
def test_get_formula_id_target_rule(report):
    """
    get formula id from reports with a rule that dispatch by target :

    the method must return this list :
    [('system',)]
    """
    ids = HWPCDispatchRule(HWPCDepthLevel.TARGET).get_formula_id(report)
    validate_formula_id(ids, [('system',)])
github powerapi-ng / powerapi / tests / unit / dispatcher_rule / test_hwpc_dispatcher_rule.py View on Github external
def test_get_formula_id_cpu_rule_report_3(report_3):
    """
    get formula id from report3 with a rule that dispatch by cpu :

    the method must return this list :
    [('toto','1', '1'), ('toto','1', '2'), ('toto','2', '3'), ('toto','2', '3')]
    """
    ids = HWPCDispatchRule(HWPCDepthLevel.CORE).get_formula_id(report_3)
    validate_formula_id(ids, [('toto', '1', '1'), ('toto', '1', '2'),
                              ('toto', '2', '3'), ('toto', '2', '4')])
github powerapi-ng / powerapi / tests / unit / dispatcher_rule / test_hwpc_dispatcher_rule.py View on Github external
def test_get_formula_id_sensor_rule(report):
    """
    get formula id from reports with a rule that dispatch by sensor :

    the method must return this list :
    [('toto',)]
    """
    ids = HWPCDispatchRule(HWPCDepthLevel.ROOT).get_formula_id(report)
    validate_formula_id(ids, [('toto',)])