001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Nuxeo - initial API and implementation 011 * 012 * $Id$ 013 */ 014package org.nuxeo.ecm.core.management.events; 015 016/** 017 * Simple class to store Listeners call statistics. 018 * 019 * @author Thierry Delprat 020 */ 021public class CallStat { 022 023 long accumulatedTime = 0; 024 025 int callCount = 0; 026 027 final String label; 028 029 public CallStat(String label) { 030 this.label = label; 031 } 032 033 void update(long delta) { 034 callCount++; 035 accumulatedTime += delta; 036 } 037 038 public long getAccumulatedTime() { 039 return accumulatedTime; 040 } 041 042 public int getCallCount() { 043 return callCount; 044 } 045 046 public String getLabel() { 047 return label; 048 } 049 050}