I have cretaed my agent by using an instance of TRCAgentUtil.java. I have
passed the projectURI,processURI,nodeURI,monitorURI to TRCAgentUtil class's
newAgent method. Here I send you my code.

public static TRCAgent newAgent(URI project_uri,
           URI monitor_uri,
           URI node_uri,
           URI process_uri,
           URI agent_uri,
           String filename,
           String monitor_name,
           String node_name,
           String process_name,
           String agent_name,
           String agent_type) throws IOException
       {

       createContainer(project_uri);

       if (agent_type == null)
           agent_type = "Profiler";

       TRCMonitor monitorroot;
       TRCNode noderoot;
       TRCProcessProxy pproxyroot;
       TRCAgentProxy aproxyroot;
       TRCAgent agentroot;

       boolean new_monitor = false;

       //
       // Create the URIs for the resources
       //
       IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace
().getRoot();
       IPath path = null;

       if (monitor_uri == null) {
           path = new Path(project_uri + "/" + filename + ".trcmxmi");
           monitor_uri = URI.createPlatformResourceURI(
workspaceRoot.getFile(
                   path).getProjectRelativePath().toString());
       }

       if (node_uri == null) {
           path = new Path(project_uri + "/" + filename + ".trcnxmi");
           node_uri = URI.createPlatformResourceURI(workspaceRoot
                   .getFile(path).getProjectRelativePath().toString());
       }

       if (process_uri == null) {
           path = new Path(project_uri + "/" + filename + ".trcpxmi");
           process_uri = URI.createPlatformResourceURI(
workspaceRoot.getFile(
                   path).getProjectRelativePath().toString());
       }

       if (agent_uri == null) {
           path = new Path(project_uri + "/" + filename + ".trcaxmi");
           agent_uri = URI.createPlatformResourceURI(workspaceRoot.getFile(
                   path).getProjectRelativePath().toString());
       }

       // TRCMonitor setup
       Resource resource = getResource(monitor_uri);
       monitorroot = (TRCMonitor) getHierarchyComponent(resource,
               TRCMonitor.class);
       if (monitorroot == null) {
           new_monitor = true;
           monitorroot = hfactory.createTRCMonitor();
           monitorroot.setName(monitor_name);
           monitorroot.setStartTime(System.currentTimeMillis());
           resource.getContents().add(monitorroot);
       }
       monitorroot.setStartTime(System.currentTimeMillis());
       monitorroot.setStopTime(System.currentTimeMillis());

       // TRCNode setup
       resource = getResource(node_uri);
       noderoot = (TRCNode) getHierarchyComponent(resource, TRCNode.class);
       if (noderoot == null) {
           noderoot = hfactory.createTRCNode();
           noderoot.setMonitor(monitorroot);
           noderoot.setName(node_name);
           noderoot.setRuntimeId("unknown");
           noderoot.setTimezone(0);
           resource.getContents().add(noderoot);
       }

       // TRCProcessProxy setup
       resource = getResource(process_uri);
       pproxyroot = (TRCProcessProxy) getHierarchyComponent(resource,
               TRCProcessProxy.class);
       if (pproxyroot == null) {
           pproxyroot = hfactory.createTRCProcessProxy();
           pproxyroot.setNode(noderoot);
           noderoot.getProcessProxies().add(pproxyroot);
           pproxyroot.setActive(true);
           // setting the PID here creates a new process for some reason
//            pproxyroot.setPid(312);
           pproxyroot.setName(process_name);
           resource.getContents().add(pproxyroot);
       }

       // TRCAgent setup
       resource = getResource(agent_uri);
       agentroot = (TRCAgent) getHierarchyComponent(resource,
TRCAgent.class);
       if (agentroot == null) {
           // TRCAgent
           agentroot = hfactory.createTRCAgent();
           agentroot.setName(agent_name);
           agentroot.setType(agent_type);
           resource.getContents().add(agentroot);

           // TRCAgentProxy setup
           aproxyroot = hfactory.createTRCAgentProxy();
           aproxyroot.setProcessProxy(pproxyroot);
           pproxyroot.getAgentProxies().add(aproxyroot);
           aproxyroot.setActive(true);
           aproxyroot.setAttached(true);
           aproxyroot.setMonitored(true);
           aproxyroot.setType(agent_type);// should this be "Profiler"?
           aproxyroot.setName(agent_name);
           aproxyroot.setStartTime(System.currentTimeMillis());
           aproxyroot.setStopTime(System.currentTimeMillis());

           // TRCAgent
           agentroot.setAgentProxy(aproxyroot);
       } else {
           aproxyroot = agentroot.getAgentProxy();
       }

       String project_path = project_uri.toString().replaceFirst(
               "platform:/resource/", "");
       IPath temp = new Path(project_path.toString().replaceFirst(
               "platform:/resource/", ""));

       saveTRCAgent(agentroot);

       try {
           MonitorViewUpdate update = new MonitorViewUpdate(monitorroot,
                   new_monitor, temp);
           Display.getDefault().syncExec(update);
       } catch (Exception e) {
           e.printStackTrace();
       }

       return agentroot;
}

Thanks.

On 4/16/07, Marius Slavescu <[EMAIL PROTECTED]> wrote:


Hi Süleyman,

When you see the time growing is the agent still in collecting mode or do
you get events after you set the stop time.

Please send me a project where I can reproduce this problem then I can
give you some advises.

Thanks !

Marius Slavescu
IBM Tivoli Autonomic Computing - Toronto Lab
Phone: 905-413-3610





 *"suleyman issiz" <[EMAIL PROTECTED]>*
Sent by: [EMAIL PROTECTED]

04/16/2007 10:05 AM  Please respond to
TPTP Tracing and Profiling Tools Project developer discussions        <
tptp-tracing-profiling-tools-dev@eclipse.org>

  To
tptp-tracing-profiling-tools-dev@eclipse.org  cc

 Subject
[tptp-tracing-profiling-tools-dev] TRC Process Set Stop Time






Hello,

I have created a new TRC Agent in my project. But I have a problem with
the time in the profiling monitor. When I am creating my agent I can set the
stop time of the process. But when displaying it on the profiling monitor it
always displays a wrong time which is increasing continously.

Does anybody have any idea about this problem?

Thanks.

Süleyman ISSIZ_______________________________________________
tptp-tracing-profiling-tools-dev mailing list
tptp-tracing-profiling-tools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev


_______________________________________________
tptp-tracing-profiling-tools-dev mailing list
tptp-tracing-profiling-tools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev


_______________________________________________
tptp-tracing-profiling-tools-dev mailing list
tptp-tracing-profiling-tools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev

Reply via email to