Logo Search packages:      
Sourcecode: visualvm version File versions  Download package

static void org::netbeans::lib::profiler::server::ProfilerRuntimeCPUFullInstr::markerMethodEntry ( char  methodId  )  [inline, static]

Called upon entry into a special root method used for

Definition at line 68 of file ProfilerRuntimeCPUFullInstr.java.

References org::netbeans::lib::profiler::server::ThreadInfo::inCallGraph, org::netbeans::lib::profiler::server::ThreadInfo::initialize(), org::netbeans::lib::profiler::server::ThreadInfo::inProfilingRuntimeMethod, org::netbeans::lib::profiler::server::ThreadInfo::isInitialized(), org::netbeans::lib::profiler::server::ThreadInfo::rootMethodStackDepth, org::netbeans::lib::profiler::server::ThreadInfo::stackDepth, and org::netbeans::lib::profiler::server::ThreadInfo::useEventBuffer().

                                                        {
        if (recursiveInstrumentationDisabled) {
            return; // See the comment at the recursiveInstrumentationDisabled variable declaration
        }

        ThreadInfo ti = ThreadInfo.getThreadInfo();

        if (ti.inProfilingRuntimeMethod > 0) {
            return;
        }

        //if (instrMethodClasses != null && methodId < instrMethodClasses.length) System.out.println("++++++Marker methodEntry for " + instrMethodClasses[methodId] + "." + instrMethodNames[methodId] + ", thread = " + Thread.currentThread());
        //else System.out.println("++++++Marker methodEntry for methodId = " + (int)methodId + ", thread = " + Thread.currentThread());
        if (!ti.isInitialized()) {
            if ((nProfiledThreadsAllowed > 0) && !ThreadInfo.isCurrentThreadProfilerServerThread()) {
                ti.initialize();
                ti.useEventBuffer();

                synchronized (eventBuffer) { // Make this happen atomically wrt. other operations on eventBuffer, such as reset collectors
                    nProfiledThreadsAllowed--;

                    ti.inProfilingRuntimeMethod++;
                    ti.inCallGraph = true;
                    writeThreadCreationEvent(ti);
                }
            } else {
                return;
            }
        } else {
            ti.inProfilingRuntimeMethod++;
            ti.inCallGraph = true;
        }

        // when methodId > 64K/2 is passed here using our instrumentation's sipush command at the call site, 
        // it's treated here as a signed integer. Thus without
        // the below fix we can get e.g. an ArrayIndexOutOfBoundsException(-32768) when methodId == 32768 (***)
        int methodIdInt = methodId&0xff;
        methodIdInt |= methodId&0xff00;
            
        if (!instrMethodInvoked[methodIdInt]) {
            if (ti.rootMethodStackDepth > 0) { // marker method under root method - perform instrumentation of nearest callees
                long absTimeStamp = Timers.getCurrentTimeInCounts();
                long threadTimeStamp = Timers.getThreadCPUTimeInNanos();
                externalActionsHandler.handleFirstTimeMethodInvoke(methodId);
                instrMethodInvoked[methodIdInt] = true; // Mark this method as invoked
                writeAdjustTimeEvent(ti, absTimeStamp, threadTimeStamp);
            } else { // DO NOT perform instrumentation of its immediate callees
                instrMethodInvoked[methodIdInt] = true;
            }
        }

        ti.stackDepth++; //= 1;  // This is the logical stack depth
        writeTimeStampedEvent(MARKER_ENTRY, ti, methodId);
        ti.inProfilingRuntimeMethod--;
    }


Generated by  Doxygen 1.6.0   Back to index