1 /* ========================================== 2 * JperfProbe : Java Performance Probes 3 * ========================================== 4 * 5 * Project Info: http://jperfprobe.sourceforge.net/ 6 * Project Lead: Tor-Erik Larsen (http://sourceforge.net/users/uptime62) 7 * 8 * (C) Copyright 2005, by Tor-Erik Larsen and Contributors. 9 * 10 * This library is free software; you can redistribute it and/or modify it 11 * under the terms of the GNU Lesser General Public License as published by 12 * the Free Software Foundation; either version 2.1 of the License, or 13 * (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 18 * License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * along with this library; if not, write to the Free Software Foundation, Inc., 22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 23 */ 24 package net.sf.jperfprobe; 25 26 /** 27 * Class DESCRIPTION 28 * 29 * @author Tor-Erik Larsen 30 * Date: Oct 30, 2008 31 * Time: 5:54:00 PM 32 */ 33 public class Snippets { 34 public static void main(String[] args) { 35 36 { 37 // START SNIPPET: static-startstop 38 StaticProbeManager.start("MyProbe"); 39 int i = 1; 40 i++; 41 StaticProbeManager.stop("MyProbe"); 42 // END SNIPPET: static-startstop 43 } 44 { 45 // START SNIPPET: static-geti 46 Probe probe = StaticProbeManager.getProbeInstance("MyProbe"); 47 // END SNIPPET: static-geti 48 } 49 { 50 Probe probe = null; 51 // START SNIPPET: probe-startstop 52 probe.start(); 53 aVeryTimeConsumingMethod(); 54 probe.stop(); 55 StaticProbeManager.addSampleFromProbe(probe); 56 // END SNIPPET: probe-startstop 57 } 58 } 59 60 61 private static void aVeryTimeConsumingMethod() { 62 63 } 64 }