/** * * @param name * @param todoFlags * @return a new {@link ElkTimer} for the current thread */ static public ElkTimer getTimerForCurrentThread(String name, int todoFlags) { return new ElkTimer(name, todoFlags, Thread.currentThread().getId()); }
/** * * @param name * @param todoFlags * @return a new {@link ElkTimer} for the current thread */ static public ElkTimer getTimerForCurrentThread(String name, int todoFlags) { return new ElkTimer(name, todoFlags, Thread.currentThread().getId()); }
/** * * @param name * @param todoFlags * @return a new {@link ElkTimer} for the current thread */ static public ElkTimer getTimerForCurrentThread(String name, int todoFlags) { return new ElkTimer(name, todoFlags, Thread.currentThread().getId()); }
/** * * @param name * @param todoFlags * @return a new {@link ElkTimer} for the current thread */ static public ElkTimer getTimerForCurrentThread(String name, int todoFlags) { return new ElkTimer(name, todoFlags, Thread.currentThread().getId()); }
/** * Get a timer of the given string name for the given thread. If no such * timer exists yet, then it will be newly created. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return timer */ public static ElkTimer getNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); ElkTimer previous = registeredTimers.putIfAbsent(key, key); if (previous != null) { return previous; } // else return key; }
/** * Get a timer of the given string name for the given thread. If no such * timer exists yet, then it will be newly created. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return timer */ public static ElkTimer getNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); ElkTimer previous = registeredTimers.putIfAbsent(key, key); if (previous != null) { return previous; } // else return key; }
/** * Get a timer of the given string name for the given thread. If no such * timer exists yet, then it will be newly created. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return timer */ public static ElkTimer getNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); ElkTimer previous = registeredTimers.putIfAbsent(key, key); if (previous != null) { return previous; } // else return key; }
/** * Get a timer of the given string name for the given thread. If no such * timer exists yet, then it will be newly created. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return timer */ public static ElkTimer getNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); registeredTimers.putIfAbsent(key, key); return registeredTimers.get(key); }
return previousTimer; } else { ElkTimer result = new ElkTimer(timerName, todoFlags, 0); result.totalCpuTime = totalCpuTime; result.totalWallTime = totalSystemTime;
return previousTimer; } else { ElkTimer result = new ElkTimer(timerName, todoFlags, 0); result.totalCpuTime = totalCpuTime; result.totalWallTime = totalSystemTime;
return previousTimer; } else { ElkTimer result = new ElkTimer(timerName, todoFlags, 0); result.totalCpuTime = totalCpuTime; result.totalWallTime = totalSystemTime;
return previousTimer; } else { ElkTimer result = new ElkTimer(timerName, todoFlags, 0); result.totalCpuTime = totalCpuTime; result.totalWallTime = totalSystemTime;
/** * Stop a timer of the given string name for the given thread. If no such * timer exists, -1 will be returned. Otherwise the return value is the CPU * time that was measured. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return CPU time if timer existed and was running, and -1 otherwise */ public static long stopNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); if (registeredTimers.containsKey(key)) { return registeredTimers.get(key).stop(); } else { return -1; } }
/** * Stop a timer of the given string name for the given thread. If no such * timer exists, -1 will be returned. Otherwise the return value is the CPU * time that was measured. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return CPU time if timer existed and was running, and -1 otherwise */ public static long stopNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); if (registeredTimers.containsKey(key)) { return registeredTimers.get(key).stop(); } else { return -1; } }
/** * Stop a timer of the given string name for the given thread. If no such * timer exists, -1 will be returned. Otherwise the return value is the CPU * time that was measured. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return CPU time if timer existed and was running, and -1 otherwise */ public static long stopNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); if (registeredTimers.containsKey(key)) { return registeredTimers.get(key).stop(); } else { return -1; } }
/** * Stop a timer of the given string name for the given thread. If no such * timer exists, -1 will be returned. Otherwise the return value is the CPU * time that was measured. * * @param timerName * the name of the timer * @param todoFlags * @param threadId * of the thread to track, or 0 if only system clock should be * tracked * @return CPU time if timer existed and was running, and -1 otherwise */ public static long stopNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); if (registeredTimers.containsKey(key)) { return registeredTimers.get(key).stop(); } else { return -1; } }