Github user JonZeolla commented on a diff in the pull request:

    https://github.com/apache/metron/pull/873#discussion_r157376611
  
    --- 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 --
    
    Do you have any metrics regarding the overhead of this?  Instead of doing 
this for all stellar commands, would it make sense to implement a TIME() 
steller function that could wrap all other commands, similar to how it 
functions on *nix boxes?


---

Reply via email to