001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.metrics; 019 020import org.apache.hadoop.hbase.HBaseInterfaceAudience; 021import org.apache.yetus.audience.InterfaceAudience; 022import org.apache.yetus.audience.InterfaceStability; 023 024/** 025 * A metric which measure the rate at which some operation is invoked. 026 */ 027@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) 028@InterfaceStability.Evolving 029public interface Meter extends Metric { 030 031 /** 032 * Records one occurrence. 033 */ 034 void mark(); 035 036 /** 037 * Records {@code events} occurrences. 038 * 039 * @param events Number of occurrences to record. 040 */ 041 void mark(long events); 042 043 /** 044 * Returns the number of events. 045 * @return the number of events. 046 */ 047 long getCount(); 048 049 /** 050 * Returns the mean rate at which events have occurred since the meter was created. 051 * @return the mean rate at which events have occurred since the meter was created 052 */ 053 double getMeanRate(); 054 055 /** 056 * Returns the one-minute exponentially-weighted moving average rate at which events have 057 * occurred since the meter was created. 058 * <p/> 059 * This rate has the same exponential decay factor as the one-minute load average in the {@code 060 * top} Unix command. 061 * 062 * @return the one-minute exponentially-weighted moving average rate at which events have 063 * occurred since the meter was created 064 */ 065 double getOneMinuteRate(); 066 067 /** 068 * Returns the five-minute exponentially-weighted moving average rate at which events have 069 * occurred since the meter was created. 070 * <p/> 071 * This rate has the same exponential decay factor as the five-minute load average in the {@code 072 * top} Unix command. 073 * 074 * @return the five-minute exponentially-weighted moving average rate at which events have 075 * occurred since the meter was created 076 */ 077 double getFiveMinuteRate(); 078 079 /** 080 * Returns the fifteen-minute exponentially-weighted moving average rate at which events have 081 * occurred since the meter was created. 082 * <p/> 083 * This rate has the same exponential decay factor as the fifteen-minute load average in the 084 * {@code top} Unix command. 085 * 086 * @return the fifteen-minute exponentially-weighted moving average rate at which events have 087 * occurred since the meter was created 088 */ 089 double getFifteenMinuteRate(); 090}