Package org.gridkit.jvmtool

Examples of org.gridkit.jvmtool.StackTraceReader


        if (classifier == null ) {
            if (simpleFilter == null) {
                return getUnclassifiedReader();
            }
            else {
                final StackTraceReader unclassified = getUnclassifiedReader();
                return new StackTraceReader() {
                       
                        @Override
                        public boolean loadNext() throws IOException {
                            while(unclassified.loadNext()) {
                                StackTraceElement[] trace = getTrace();
                                for(StackTraceElement e: trace) {
                                    if (e.toString().startsWith(simpleFilter)) {
                                        return true;
                                    }
                                }
                            }
                            return false;
                        }
                       
                        @Override
                        public boolean isLoaded() {
                            return unclassified.isLoaded();
                        }
                       
                        @Override
                        public StackTraceElement[] getTrace() {
                            return unclassified.getTrace();
                        }
                       
                        @Override
                        public long getTimestamp() {
                            return unclassified.getTimestamp();
                        }
                       
                        @Override
                        public long getThreadId() {
                            return unclassified.getThreadId();
                        }
                    };
            }
        }
        else {
            if (simpleFilter != null) {
                SJK.fail("Simple filter cannot be used with classification");
            }           
            if (bucket != null && !buckets.getClasses().contains(bucket)) {
                SJK.fail("Bucket [" + bucket + "] is not defined");
            }
            final StackTraceReader unfiltered = getUnclassifiedReader();
            return new StackTraceReader() {

                    @Override
                    public boolean loadNext() throws IOException {
                        while(true) {
                            if (unfiltered.loadNext()) {
                                String cl = buckets.classify(unfiltered.getTrace());
                                if (bucket != null) {
                                    if (!bucket.equals(cl)) {
                                        continue;
                                    }
                                }
                                else if (cl == null) {
                                    continue;
                                }
                                return true;
                            }
                            else {
                                return false;
                            }
                        }
                    }

                    @Override
                    public boolean isLoaded() {
                        return unfiltered.isLoaded();
                    }

                    @Override
                    public StackTraceElement[] getTrace() {
                        return unfiltered.getTrace();
                    }

                    @Override
                    public long getTimestamp() {
                        return unfiltered.getTimestamp();
                    }

                    @Override
                    public long getThreadId() {
                        return unfiltered.getThreadId();
                    }
                };
        }
    }
View Full Code Here


            @Override
      public void run() {
        try {
           
              StackTraceReader reader = getFilteredReader();
              while(reader.loadNext()) {
                  String timestamp = Formats.toDatestamp(reader.getTimestamp());
                  System.out.println(String.format("Thread [%d] at %s", reader.getThreadId(), timestamp));
                  StackTraceElement[] trace = reader.getTrace();
                  for(int i = 0; i != trace.length; ++i) {
                      System.out.println(trace[i]);
                  }
                  System.out.println();
              }
View Full Code Here

            public void run() {
                try {

                    StackHisto histo = new StackHisto();
                   
                    StackTraceReader reader = getFilteredReader();
                    while(reader.loadNext()) {
                        StackTraceElement[] trace = reader.getTrace();
                        histo.feed(trace);
                    }
                   
                    System.out.println(histo.formatHisto());
                   
View Full Code Here

                    }
                    List<String> bucketNames = new ArrayList<String>(buckets.getClasses());
                    long[] counters = new long[bucketNames.size()];
                    long total = 0;

                    StackTraceReader reader = getUnclassifiedReader();
                    while(reader.loadNext()) {
                        StackTraceElement[] trace = reader.getTrace();
                        String cl = buckets.classify(trace);
                        if (cl != null) {
                            ++total;
                            ++counters[bucketNames.indexOf(cl)];
                        }
View Full Code Here

TOP

Related Classes of org.gridkit.jvmtool.StackTraceReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.