Esempio n. 1
0
    def resolveEvents(eventsDb, cpuSet, events):
        """
    Resolves a list of given pmu events from events database

    :param eventsDb: Handle to database of PMU events for the target cpu
    :param events: List of PMU events to be enabled for the current profile session
    :param cpuSet: List of cpu, where the userspace pmu collection will be enabled

    """
        from xpedite.pmu.pmuctrl import PMUCtrl
        return PMUCtrl.resolveEvents(eventsDb, cpuSet, events)
Esempio n. 2
0
def test_request_sorter():
    eventsFile = os.path.join(os.path.dirname(__file__), 'test_events.json')
    eventsDb = EventsLoader().loadJson(eventsFile)
    assert eventsDb
    events = [
        Event('EVENT_3', 'EVENT_3'),
        Event('EVENT_2', 'EVENT_2'),
        Event('EVENT_1', 'EVENT_1'),
        Event('EVENT_0', 'EVENT_0'),
    ]
    eventState = PMUCtrl.resolveEvents(eventsDb, [0], events)
    assert len(eventState) == len(events)
    assert len(eventState.genericRequests) == len(events)
    for i, event in enumerate(events):
        assert event.uarchName == eventState.genericRequests[i].uarchName
    PMUCtrl.allocateEvents(eventState)
    assert len(eventState.genericRequests) == len(events)
    print(eventState.genericRequests)
    for i, event in enumerate(events):
        assert event.uarchName == eventState.genericRequests[len(events) - i -
                                                             1].uarchName