-
Notifications
You must be signed in to change notification settings - Fork 952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BTRACE-45] Print multiple aggregations in one printAggregation() command #35
Comments
[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 ? |
[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); I'll leave it up to you to decide which option you like best, but I quite like the last solution best. |
[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) |
[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. |
[author="joachimhskeie", created="Fri, 13 Aug 2010 10:30:45 +0200"] I will push the changes over the weekend. |
[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. |
[author="joachimhskeie", created="Mon, 23 Aug 2010 22:34:27 +0200"] Changing Fix Version to 1.2 as per comments from JB. |
[reporter="joachimhskeie", created="Sat, 17 Jul 2010 23:09:55 +0200", resolved="Mon, 23 Aug 2010 22:34:50 +0200"]
Often when reporting on Average Execution times for classes, I would like to be able to report on both the average execution time and the number of executions that average is calculated from via the same printAggregation method.
I am attaching a diff file that adds a "CountingAverage" aggregation type, extending from the Average aggregation type. I am also modifying the GridDataCommand to support the new CountingAverageData class.
I am not quite happy with the following, although I dont have any good suggestions for improvements without refactoring the methods signatures:
Another approach to this issue would be to add a method printAggregation(String stringFormat, Aggregation ... aggregationArray) that would combine the results from multiple aggregations for output, assuming they use the same AggregationKey. This might be the better option in this (and other) case(s). I could have a look into a possible solution to this if you would rather see this type of solution.
The text was updated successfully, but these errors were encountered: