Building scripts with 1.3 mavenized branch

  2 posts   Feedicon  
Replies: 1 - Last Post: October 11, 2011 21:17
by: Jaroslav Bachorik
showing 1 - 2 of 2
 
Posted: September 27, 2011 07:36 by joachimhskeie
Hello,

I am trying to make a very simple script using the extensions. The script is as follows:

package org.eurekaj.btracers;

import com.sun.btrace.annotations.*;
import static com.sun.btrace.ext.Collections.*;
import java.util.Deque;

@BTrace
public class CpuInfo {
	private static Deque<Long> sysTimeQueue = com.sun.btrace.ext.Collections.BTraceDeque();
	private static Deque<Double> totalCpuTimeQueue = com.sun.btrace.ext.Collections.BTraceDeque();
	
	@OnTimer(15000)
	public static void printCpu() {
		Long timePeriod = com.sun.btrace.ext.Time.millis();
	}

}



However, I am not sure how the script is able to access the methods within the extensions. When I try to compile the script above I get:

jhs:btraceScripts jhs$ echo $BTRACE_HOME 
/Users/jhs/Projects/btracemaven/btrace~core-maven/btrace-dist/target/btrace


jhs:btraceScripts jhs$ /.//Users/jhs/Projects/btracemaven/btrace\~core-maven/btrace-dist/target/bin/btracec CpuInfo.java 
>>> located extensions
>>> com.sun.btrace.ext.profiling.Profiling
>>> com.sun.btrace.ext.Counters
>>> com.sun.btrace.ext.Aggregations
>>> com.sun.btrace.ext.Reflective
>>> com.sun.btrace.ext.Printer
>>> com.sun.btrace.ext.sys.Env
>>> com.sun.btrace.ext.sys.Memory
>>> com.sun.btrace.ext.export.Export
>>> com.sun.btrace.ext.Atomic
>>> com.sun.btrace.ext.sys.Process
>>> com.sun.btrace.ext.Time
>>> com.sun.btrace.ext.Strings
>>> com.sun.btrace.ext.Collections
>>> com.sun.btrace.ext.Numbers
>>> com.sun.btrace.ext.sys.VM
>>> com.sun.btrace.ext.Threads
>>> com.sun.btrace.ext.References
CpuInfo.java:4: package com.sun.btrace.ext does not exist
CpuInfo.java:4: package com.sun.btrace.ext does not exist
CpuInfo.java:9: package com.sun.btrace.ext does not exist
CpuInfo.java:10: package com.sun.btrace.ext does not exist
CpuInfo.java:14: package com.sun.btrace.ext does not exist
error: CpuInfo.java:9:method calls are not allowed - only calls to BTraceUtils are allowed
error: CpuInfo.java:10:method calls are not allowed - only calls to BTraceUtils are allowed



I have tried different approaches, but it seems com.sun.btrace.ext can be found... Am I doing something wrong here ?
 
Posted: October 11, 2011 21:17 by Jaroslav Bachorik
Hi, first of all sorry for the long roundtrip ... was being kept busy Frown

Unfortunately, you hit the only extension class with a problem. I forgot to mention the com.sun.btrace.ext.collections.BTrace* classes in the extension manifest located in the btrace-extensions project under src/main/resources/META-INF/services.

Also, you must usecom.sun.btrace.ext.Collections.newDeque() method instead of com.sun.btrace.ext.Collections.BTraceDeque() you are using.

Cheers

-JB-
Replies: 1 - Last Post: October 11, 2011 21:17
by: Jaroslav Bachorik
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close