Git Product home page Git Product logo

Comments (8)

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Wed, 4 Aug 2010 15:42:10 +0200"]

I am unable to make the BTrace compiler accept the varargs parameters like:

printAggregation(String stringFormat, Aggregation ... aggregationArray)

I am able to make this work with a single Aggregation, but with multiple aggregations the BTrace Compiler states that only methods for BTraceUtils might be used.

Is this a shortcoming of the BTrace Compiler class ?

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Thu, 5 Aug 2010 22:37:44 +0200"]

I found the culprit in the VerifierVisitor class. I added a bit of code that makes the compiler compile the class when the method in BTraceUtils is a varargs method. However, this would need some type checking.

Actually, looking at the code, I would assume it safer if all parameter types were checked, and not just a check to see if the method invoked has the same amount of parameters

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Thu, 5 Aug 2010 23:37:34 +0200"]

I was unable to the the varargs method to work at all (the JVM translates the varargs arguments to an Array, which causes the Verifier to think that the BTrace Script is creating a new Array.

I have instead opted to implement this functionality using the Collections that were available in BTraceUtils already.

I think this is a better option than the CountingAverage approach as this makes it possible to combine any Aggregation, as long as it has the same AggregationKey.

I am attaching a diff new diff file which implements this functionality as well.

I am using the Aggregation in a script as follows:

    @OnTimer(7500)
    public static void printAverage() {
        Deque aggregationDeque = newDeque();
        addLast(aggregationDeque, AVERAGE);
        addLast(aggregationDeque, CALLS_PER_INTERVAL);
    <span class="code-object">String</span> execStringFormat = strcat(<span class="code-quote">"[AverageExecTime;"</span>, property(<span class="code-quote">"btrace.agentname"</span>));
    Aggregations.printAggregation(<span class="code-quote">"", strcat(execStringFormat, "</span>;%1$s;%2$s;%3$d;%4$s;%5$s;%6$s;Custom]"), aggregationDeque);
    
    truncateAggregation(AVERAGE, 0);
    truncateAggregation(CALLS_PER_INTERVAL, 0);
}   

I'll leave it up to you to decide which option you like best, but I quite like the last solution best.

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="jbachorik", created="Mon, 9 Aug 2010 11:01:15 +0200"]

The enhanced version of printAggregation() method sounds good.

Go ahead and push the changes. Please, make sure all the newly added public methods are properly documented and don't forget to add the @SInCE tag (for version 1.2)

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="jbachorik", created="Fri, 13 Aug 2010 09:54:35 +0200"]

Will you be able to push the changes soon? If not I might apply the changes for you.
I want to start preparations for 1.2 release and I need to have all issues targeted for 1.2 resolved.

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Fri, 13 Aug 2010 10:30:45 +0200"]

I will push the changes over the weekend.

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Mon, 23 Aug 2010 22:33:54 +0200"]

Sorry for the late push! I have pushed the changes now. I chose not to push the CountingAverage Aggregation, as its probably redundant with the ability to combine aggregations into a single print.

from btrace.

jbachorik avatar jbachorik commented on July 24, 2024

[author="joachimhskeie", created="Mon, 23 Aug 2010 22:34:27 +0200"]

Changing Fix Version to 1.2 as per comments from JB.

from btrace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.