Package edu.brown.cs.rampcommon

Examples of edu.brown.cs.rampcommon.RampException


            xw.end("THREADGROUPS");
            xw.close();
        }catch (IOException e)
        {
            throw new RampException("Failed to write thread groupg file", e);
        }

        for (ThreadDescriptor td:m_mapThreadsToNames.values())
        {
            if (td.m_iID == -1)
View Full Code Here


            xw.end("THREADSET");
            xw.close();
        }catch (IOException e)
        {
            throw new RampException(String.format("Failed to output code fragments for the thread set",strFileName), e);
        }
    }
View Full Code Here

                    continue;
                }

                if (thread.m_iID != iID)
                {
                    throw new RampException(String.format("IDs does not match for thread %s: read ID=%d, expected ID=%d",strThreadName, iID, thread.m_iID));
                }
                if (!thread.m_group.getName().equals(strGroupName))
                {
                    throw new RampException(String.format("Group does not match for thread %s: read group=%s, expected group=%d",strThreadName, strGroupName, thread.m_group.getName()));
                }

                //Read the CF set for the element
                Element elemCFSET = IvyXml.getChild(elemTHREAD, "CFSET");
                thread.getCodeFragmentSet().fromXML(elemCFSET);
            }

            //Read THREADGRUOP elements
            for (Element elemTHREADGROUP : IvyXml.children(root, "THREADGROUP"))
            {
                String strThreadGroupName = IvyXml.getAttrString(elemTHREADGROUP, "NAME");
                ThreadGroupDescriptor threadGroup = this.m_setThreadGroups.get(strThreadGroupName);
                //Do sanity checks
                if (threadGroup == null)
                {
                    //Similar to the thread: this can happen if we have a set of CFs from the run, where
                    //the number of working threads is different (e.g. with a different
                    //configuration). This can happen if we are analyzing results
                    //of the run using a "thread_codefragments.xml" file from another run
                    //throw new RampException(String.format("Failed to find thread with name = %s",strThreadName));
                    System.err.println(String.format("WARNING: Failed to find thread group with name = %s. Are you using \"thread_codefragments.xml\" from another run?",strThreadGroupName));
                    continue;
                    //throw new RampException(String.format("Failed to find thread group with name = %s",strThreadGroupName));
                }

                //Read the CF set for the element
                Element elemCFSET = IvyXml.getChild(elemTHREADGROUP, "CFSET");
                threadGroup.getCodeFragmentSet().fromXML(elemCFSET);
            }

        }catch (Exception e)
        {
            throw new RampException(String.format("Failed to read code fragments for the thread set",strFileName), e);
        }
    }
View Full Code Here

                m_iStartProbeID = IvyXml.getAttrInt(elem, "STARTID");
                m_iEndProbeID = IvyXml.getAttrInt(elem, "ENDID");
                m_strName = m_strThreadGroupName + "_" + m_iStartProbeID + "_" + m_iEndProbeID;
            } else
            {
                throw new RampException(elem.getTagName() + " element has incomplete information ");
            }
        }
View Full Code Here

    {
        if (m_strRampBinClassPath != null)
            return m_strRampBinClassPath;
        if (m_fileRampBinaryDir == null)
        {
            throw new RampException("Path to RAMP binaries is not set");
        }
        StringBuilder bldPath = new StringBuilder();
        bldPath.append(getRampNBPath());
        bldPath.append("/ramp/build/classes");
        bldPath.append(File.pathSeparator);
View Full Code Here

     */
    public final String getRampLibPath() throws RampException
    {
        if (m_fileRampBinaryDir == null)
        {
            throw new RampException("Path to RAMP binaries is not set");
        }
        return m_fileRampBinaryDir.getAbsolutePath()+"/lib";
    }
View Full Code Here

   
    public final String getRampNBPath() throws RampException
    {
        if (m_fileRampBinaryDir == null)
        {
            throw new RampException("Path to RAMP binaries is not set");
        }
        return m_fileRampBinaryDir.getAbsolutePath()+"/NB";
       
    }
View Full Code Here

   
    public final String getASMLibraryPath() throws RampException
    {
        if (m_fileRampBinaryDir == null)
        {
            throw new RampException("Path to RAMP binaries is not set");
        }
        StringBuilder bldPath = new StringBuilder();
        bldPath.append(getRampLibPath());
        bldPath.append("/rampasm.jar");
        bldPath.append(File.pathSeparator);
View Full Code Here

    {
        int iRdyitPortNumber = 17883;
       
        if (m_fileRampBinaryDir == null)
        {
            throw new RampException("Path to RAMP binaries is not set");
        }

        ArrayList<String> arrProgramCmdArgs = new ArrayList<String>();
        //cmdargs.add("-Dpid=$$");
        arrProgramCmdArgs.add("-noverify");
        arrProgramCmdArgs.add("-agentpath:" + getRampLibPath()+"/librvmti.so");

        /*
         * BUGBUG: here we store the log file in the RAM disk mounted at /mnt/tmpfs
         */
        File fnm = new File(m_fileProjectDir, RampFileNames.strMainRdyitLogFile);
        //File fnm = new File("/mnt/tmpfs", RampFileNames.strMainRdyitLogFile);
        File fileDiskPatch = new File(m_fileCommonDir.getPath(), RampFileNames.strDiskPatch);
        File fileNetPatch = new File(m_fileCommonDir.getPath(), RampFileNames.strSocketPatch);
        File fileProgramPatch = new File(m_fileProjectDir, RampFileNames.strMainPatch);
        String strProgramPatchPath = fileProgramPatch.getPath().trim();
        //arrProgramCmdArgs.add("-javaagent:" + getRampNBPath() + "/rdyit/dist/rdyit.jar=OUTPUT=" + fnm.getPath() + ":SPEC=" + strProgramPatchPath + ":IO=" + fileDiskPatch.getPath() + ":NET=" + fileNetPatch.getPath());

        File fileLibSet = new File(m_fileProjectDir, RampFileNames.strLibraryProbesSet);
        if (fileLibSet.exists())
        {
            arrProgramCmdArgs.add("-javaagent:" + getRampNBPath() + "/rdyit/dist/rdyit.jar=OUTPUT=" + fnm.getPath() + ":SPEC=" + strProgramPatchPath + ":IO=" + fileDiskPatch.getPath() + ":NET=" + fileNetPatch.getPath()+":LIBSET="+fileLibSet.getPath());
        }else
        {
            arrProgramCmdArgs.add("-javaagent:" + getRampNBPath() + "/rdyit/dist/rdyit.jar=OUTPUT=" + fnm.getPath() + ":SPEC=" + strProgramPatchPath + ":IO=" + fileDiskPatch.getPath() + ":NET=" + fileNetPatch.getPath());           
        }

        arrProgramCmdArgs.add("-Xbootclasspath/a:" + getASMLibraryPath() + ":" + getRampNBPath() + "/rdyit/dist/rdyit.jar");


        StringBuilder strRdyitCP = new StringBuilder();
        strRdyitCP.append("java -cp ");
        strRdyitCP.append(getRampBinClassPath());
        strRdyitCP.append(File.pathSeparator);
        strRdyitCP.append(getASMLibraryPath());
/*
        strRdyitCP.append(m_fileRampBinaryDir.getAbsolutePath());
        strRdyitCP.append("/lib/rampasm.jar");
        strRdyitCP.append(File.pathSeparator);
        strRdyitCP.append(m_fileRampBinaryDir.getAbsolutePath());
        strRdyitCP.append("/lib/sprasm.jar");
*/
        //strRdyitCP.append(File.pathSeparator);
       
        strRdyitCP.append(" edu.brown.cs.ramp.rdyit.RdyitMain -p ").append(iRdyitPortNumber);
        strRdyitCP.append(" -s ").append(m_fileProjectDir.getAbsolutePath()).append("/mainpatch.xml");
        strRdyitCP.append(" -s ").append(this.m_fileCommonDir.getAbsolutePath()).append("/diskpatch.xml");
        strRdyitCP.append(" -s ").append(this.m_fileCommonDir.getAbsolutePath()).append("/socketpath.xml");
        strRdyitCP.append(" -w ").append(m_fileProjectDir.getAbsolutePath()).append("/wrappers.xml");
       
       
        IvyExec exServer = null;

        //String cmd = "/research/people/spr/ramp/bin/rdynserver " + f.getPath();
        //String cmdServer = getRampHome() + "/bin/rdyitserver " + m_fileProjectDir.getPath();
        try
        {
            //Create and run the rdyitserver so we could instrument
            //native/synchronized methods

            exServer = new IvyExec(strRdyitCP.toString());
            try
            {
                Thread.sleep(10000);
            } catch (InterruptedException e)
            {
            }
            if (exServer == null)
            {
                throw new RampException("Failed to run the RDYIT server");
            }
/*
            System.out.println("Command line for the application to run:");
            for (String str:arrProgramCmdArgs)
            {
                System.out.print(str);
                System.out.print(" ");
            }
            System.out.println();
*/
            //Run the instrumented program
            Process p = m_rampProject.run(arrProgramCmdArgs);
            if (p == null)
            {
                throw new RampException("Failed to run the instrumented program");
            }

            //Write out its stdout/stderr
            InputStream stderr = p.getErrorStream();
            InputStream stdout = p.getInputStream();
View Full Code Here

            //data_writer = new IvyXmlWriter(f1);
            pxw = new IvyXmlWriter(f2);
            writerWrappers = new IvyXmlWriter(fileWrappers);
        } catch (IOException e)
        {
            throw new RampException("RAMP: Can't create patch file " + f2.getPath() + ": " + e);
        }


        writerWrappers.begin("WRAPPERS");
View Full Code Here

TOP

Related Classes of edu.brown.cs.rampcommon.RampException

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.