Package edu.brown.cs.codefragment

Examples of edu.brown.cs.codefragment.CodeFragmentDescriptor


            //Pick CFs with minimum summary time one by one, until we either
            //breach the threashold or pick all the available CFs
            while (dblCurrentSkipTime < dblCPUThreshold)
            {
                double dblMinSumTime = Double.MAX_VALUE;
                CodeFragmentDescriptor cfFound = null;
                for (CodeFragmentDescriptor cf : cfSet.getCodeFragments())
                {
                    if (setInsignificant.contains(cf))
                    {
                        continue;
                    }
                    if (cf.getCodeFragmentType() == CodeFragmentType.COMPUTATION)
                    {
                        if (cf.getSumTime() < dblMinSumTime)
                        {
                            dblMinSumTime = cf.getSumTime();
                            cfFound = cf;
                        }
                    }
                }
                if (cfFound == null)
                {   //We can't find insignificant CFs any more
                    break;
                }
                if ((dblCurrentSkipTime + cfFound.getSumTime()) <= dblCPUThreshold)
                {   //Found insignificant CF
                    System.out.println(String.format("Computational CF %s is insignificant: time %f, current skiptime %f, threshold %f",
                            cfFound, cfFound.getSumTime(), dblCurrentSkipTime, dblCPUThreshold));
                    setInsignificant.add(cfFound);
                    dblCurrentSkipTime += cfFound.getSumTime();
                } else
                {
                    break;
                }
            }

            //Pick CFs with minimum summary time one by one, until we either
            //breach the threashold or pick all the available CFs
            while ((dblCurrentIOCount < dblIOCountThreshold) &&
                   (dblCurrentIOSize < dblIOSizeThreshold))
            {
                double dblMinIOScore = Double.MAX_VALUE;
                CodeFragmentDescriptor cfFound = null;
                for (CodeFragmentDescriptor cf : cfSet.getCodeFragments())
                {
                    if (setInsignificant.contains(cf))
                    {
                        continue;
                    }
                    if (canCFCauseIO(cf))
                    {
                        Integer intIOCount = (Integer) cf.getParameterValue(CodeFragmentParam.IO_COUNT);
                        Integer intIOSize = (Integer)cf.getParameterValue(CodeFragmentParam.IO_SIZE);
                       
                        if (intIOCount == 0)
                        {
                            throw new RampException(String.format("Number of I/O operations is 0 for the CF %s, thread %d",
                                    cf.getName(), threadDesc.m_iID));
                        }
                                 
                        if (intIOSize == 0)
                        {
                            throw new RampException(String.format("Summary I/O size is 0 for the CF %s, thread %d",
                                    cf.getName(), threadDesc.m_iID));
                        }
                       
                        double dblIOScore = ((double)intIOCount)/dblSumIOCount+
                                ((double)intIOSize)/dblSumIOSize;

                        //double dblIOScore = ((double) intIOCount)*dblIOCountScaleCoef +
                        //        ((double) intIOSize)*dblIOSizeScaleCoef;
                        if (cf.getSumTime() < dblMinIOScore)
                        {
                            dblMinIOScore = dblIOScore;
                            cfFound = cf;
                        }
                    }
                }
                if (cfFound == null)
                {   //We can't find insignificant CFs any more
                    break;
                }
                if (
                        ((dblCurrentIOCount + (Integer)cfFound.getParameterValue(CodeFragmentParam.IO_COUNT)) <= dblIOCountThreshold) &&
                        ((dblCurrentIOSize + (Integer)cfFound.getParameterValue(CodeFragmentParam.IO_SIZE)) <= dblIOSizeThreshold)
                   )
                {   //Found insignificant CF
                    System.out.println(String.format("I/O CF %s is insignificant: I/O size %d, I/O count %d, current skip size %f, skip time %f, size threshold %f, time threshold %f",
                            cfFound,
                            (Integer)cfFound.getParameterValue(CodeFragmentParam.IO_SIZE),
                            (Integer)cfFound.getParameterValue(CodeFragmentParam.IO_COUNT),
                            dblCurrentIOSize,
                            dblCurrentIOCount,
                            dblIOSizeThreshold,
                            dblIOCountThreshold));
                    setInsignificant.add(cfFound);
                    dblCurrentIOCount += (Integer)cfFound.getParameterValue(CodeFragmentParam.IO_COUNT);
                    dblCurrentIOSize += (Integer)cfFound.getParameterValue(CodeFragmentParam.IO_SIZE);
                } else
                {
                    break;
                }
            }
View Full Code Here


            {
                throw new LogAnalyzerException(String.format("Java I/O records are not sorted. Record at line %d is out of order", this.m_iCurrentLine));
            }
            lTimestampPrev = lTimestampStart;

            CodeFragmentDescriptor cf = getCFByName(strProbeID, iTID);
            if (cf == null)
            {
                return;
            }

            ThreadMatchIOContext context = m_arrThreadMatchJava.get(iTID);
            if (context == null)
            {
                context = new ThreadMatchIOContext();
                m_arrThreadMatchJava.put(iTID, context);
            }

            if (cf.getCodeFragmentType() == CodeFragmentType.FILE_STAT)
            {   //BUGBUG: FILE_OPEN can also involve some I/O operations
                context.addReadMeta(lTimestampStart, lTimestampEnd);
            } else if (cf.getCodeFragmentType() == CodeFragmentType.DISK_IO_READ)
            {   //This is read I/O
                context.addRead(lTimestampStart, lTimestampEnd);
            }

            //dblJavaLength = lTimestampEnd-lStart;
View Full Code Here

     */
    void issueCF(LoopDetectorThreadContext context,
            String entry,
            LoopDescriptor loopDesc)
    {
        CodeFragmentDescriptor cf = context.m_mapThreadCFs.get(entry);
        CallGraph cgToAdd = null;

        if (loopDesc == null)
        {   //This entry should be added to the global call graph that contains
            //the high-level execution of the program
View Full Code Here

        CodeFragmentSet cfs = td.getCodeFragmentSet();

        boolean bRetainLoop = false;
        for(String strLoopEntry:loopDesc.m_lstLoopBody)
        {
            CodeFragmentDescriptor cfDesc = cfs.getCodeFragmentByName(strLoopEntry);
            if (cfDesc != null)
            {
                if (cfDesc.getCodeFragmentType() == CodeFragmentType.BLOCKING_QUEUE_PUT)
                    bRetainLoop = true;
/*
                if (cfDesc.getCodeFragmentType() == CodeFragmentType.THREAD_START)
                    bRetainLoop = true;
*/
                if (cfDesc.getCodeFragmentType() == CodeFragmentType.BLOCKING_QUEUE_POLL)
                    return false;
                if (cfDesc.getCodeFragmentType() == CodeFragmentType.SOCKET_IO_ACCEPT)
                    return false;
            }
        }
        return bRetainLoop;
    }
View Full Code Here

TOP

Related Classes of edu.brown.cs.codefragment.CodeFragmentDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.