Search in sources :

Example 6 with ProfilingDataManager

use of com.evolveum.midpoint.util.aspect.ProfilingDataManager in project midpoint by Evolveum.

the class ProfilingTest method prof_05_subsystemProfilingTest.

@Test
public void prof_05_subsystemProfilingTest() {
    Map<ProfilingDataManager.Subsystem, Boolean> confMap = new HashMap<>();
    confMap.put(ProfilingDataManager.Subsystem.MODEL, true);
    confMap.put(ProfilingDataManager.Subsystem.REPOSITORY, true);
    confMap.put(ProfilingDataManager.Subsystem.SYNCHRONIZATION_SERVICE, false);
    confMap.put(ProfilingDataManager.Subsystem.WEB, false);
    confMap.put(ProfilingDataManager.Subsystem.WORKFLOW, false);
    confMap.put(ProfilingDataManager.Subsystem.PROVISIONING, false);
    confMap.put(ProfilingDataManager.Subsystem.UCF, false);
    confMap.put(ProfilingDataManager.Subsystem.TASK_MANAGER, false);
    ProfilingDataManager.getInstance().configureProfilingDataManager(confMap, 10, true, false, false);
    ProfilingDataManager manager = ProfilingDataManager.getInstance();
    //6 prof. events are created, there should be 2 keys in HashMap
    Long startTime = System.nanoTime();
    manager.applyGranularityFilterOnEnd("class", "method", new String[] { "1", "2", "3" }, ProfilingDataManager.Subsystem.MODEL, System.currentTimeMillis(), startTime);
    manager.applyGranularityFilterOnEnd("class", "method", new String[] { "1", "2", "3" }, ProfilingDataManager.Subsystem.MODEL, System.currentTimeMillis(), startTime);
    manager.applyGranularityFilterOnEnd("class", "method", new String[] { "1", "2", "3" }, ProfilingDataManager.Subsystem.MODEL, System.currentTimeMillis(), startTime);
    manager.applyGranularityFilterOnEnd("class2", "method", new String[] { "1", "2", "3" }, ProfilingDataManager.Subsystem.REPOSITORY, System.currentTimeMillis(), startTime);
    manager.applyGranularityFilterOnEnd("class2", "method", new String[] { "1", "2", "3" }, ProfilingDataManager.Subsystem.REPOSITORY, System.currentTimeMillis(), startTime);
    manager.applyGranularityFilterOnEnd("class2", "method", new String[] { "1", "2", "3" }, ProfilingDataManager.Subsystem.REPOSITORY, System.currentTimeMillis(), startTime);
    Map<String, MethodUsageStatistics> perfMap = manager.getPerformanceMap();
    //Now we test the results
    assertSame(2, perfMap.keySet().size());
}
Also used : ProfilingDataManager(com.evolveum.midpoint.util.aspect.ProfilingDataManager) HashMap(java.util.HashMap) MethodUsageStatistics(com.evolveum.midpoint.util.aspect.MethodUsageStatistics) Test(org.testng.annotations.Test)

Aggregations

ProfilingDataManager (com.evolveum.midpoint.util.aspect.ProfilingDataManager)6 HashMap (java.util.HashMap)4 Test (org.testng.annotations.Test)4 MethodUsageStatistics (com.evolveum.midpoint.util.aspect.MethodUsageStatistics)2 ProfilingDataLog (com.evolveum.midpoint.util.aspect.ProfilingDataLog)2 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)2 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)2 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)2 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)2 Lsof (com.evolveum.midpoint.test.util.Lsof)1