예제 #1
0
        /// <summary>
        /// Handle notification that method profiling has finished writing
        /// data to disk.
        /// </summary>
        private void handleMPRE(Client client, ByteBuffer data)
        {
            // get the filename and make the client not have pending HPROF dump anymore.
            string filename = client.clientData.pendingMethodProfiling;

            client.clientData.pendingMethodProfiling = null;

            byte result = data.get();

            // get the app-level handler for method tracing dump
            ClientData.IMethodProfilingHandler handler = ClientData.methodProfilingHandler;
            if (handler != null)
            {
                if (result == 0)
                {
                    handler.onSuccess(filename, client);

                    Log.d("ddm-prof", "Method profiling has finished");
                }
                else
                {
                    handler.onEndFailure(client, null);                     //message

                    Log.w("ddm-prof", "Method profiling has failed (check device log)");
                }
            }

            client.clientData.methodProfilingStatus = ClientData.MethodProfilingStatus.OFF;
            client.update(Client.CHANGE_METHOD_PROFILING_STATUS);
        }
예제 #2
0
        /// <summary>
        /// Handle incoming profiling data.  The MPSE packet includes the
        /// complete .trace file.
        /// </summary>
        private void handleMPSE(Client client, ByteBuffer data)
        {
            ClientData.IMethodProfilingHandler handler = ClientData.methodProfilingHandler;
            if (handler != null)
            {
                var stuff = new byte[data.capacity];
                data.get(stuff, 0, stuff.Length);

                Log.d("ddm-prof", "got trace file, size: " + stuff.Length + " bytes");

                handler.onSuccess(stuff, client);
            }

            client.clientData.methodProfilingStatus = ClientData.MethodProfilingStatus.OFF;
            client.update(Client.CHANGE_METHOD_PROFILING_STATUS);
        }