JPDA MethodEntryEvent causing app to run very slow

195 Views Asked by At

I am trying to capture all method calls made in any android app. For that I am using JDI to register MethodEntryRequest for each running thread of the app. I am successful to do this, but I am facing the problem that the app becomes very very slow. So I want to know if I am doing anything wrong in my implementation. I am adding my code where I first register ClassPreparedRequest to catch loading of each class by app process and in that I register MethodEntryRequest with threadfilter for thread which caused the class to load.

 if(!traceMap.keySet().contains(event.thread()))
    {
        EventRequestManager mgr = vm.eventRequestManager();
        MethodEntryRequest menr = mgr.createMethodEntryRequest();
        menr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
        menr.addThreadFilter(event.thread());
        menr.enable();
    }

Code for registering ClassPreparedRequest is

    ClassPrepareRequest cpr = mgr.createClassPrepareRequest();        
    cpr.addClassFilter("com.example.*");
    cpr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
    cpr.enable();  
0

There are 0 best solutions below