[
https://issues.apache.org/jira/browse/METRON-1367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294421#comment-16294421
]
ASF GitHub Bot commented on METRON-1367:
----------------------------------------
Github user JonZeolla commented on a diff in the pull request:
https://github.com/apache/metron/pull/873#discussion_r157385625
--- Diff:
metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/StellarExecutor.java
---
@@ -289,7 +293,25 @@ public Object execute(String expression) {
VariableResolver variableResolver = new
MapVariableResolver(Maps.transformValues(variables, result ->
result.getResult())
,
Collections.emptyMap());
StellarProcessor processor = new StellarProcessor();
- return processor.parse(expression, variableResolver, functionResolver,
context);
+ StackWatch watch = new StackWatch("execute");
+ watch.startTime(expression);
+ context.setWatch(watch);
+ try {
+ return processor.parse(expression, variableResolver,
functionResolver, context);
+ } finally {
+ watch.stopTime();
+ final StringBuffer buff = new StringBuffer();
+ watch.visit(((level, node) -> {
+ for (int i = 0; i < level; i++) {
+ buff.append("-");
+ }
+ buff.append("->");
+ buff.append(node.getName()).append(" :
").append(node.getTime()).append("ms : ").
+ append(node.getNanoTime()).append("ns").append("\n");
+ }));
+ lastTiming = Optional.of(buff.toString());
+ context.clearWatch();
+ }
--- End diff --
That makes sense, just looking to limit the effect here.
> Stellar should optionally instrument function calls
> ---------------------------------------------------
>
> Key: METRON-1367
> URL: https://issues.apache.org/jira/browse/METRON-1367
> Project: Metron
> Issue Type: Improvement
> Reporter: Otto Fowler
> Assignee: Otto Fowler
>
> It would be nice if stellar processor(s) could optionally instrument function
> calls to test performance.
> The result would be some structure with the calls, the times and maybe some
> context as a list or map
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)