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 * @param events Number of occurrences to record. 039 */ 040 void mark(long events); 041 042 /** 043 * Returns the number of events. 044 * @return the number of events. 045 */ 046 long getCount(); 047 048 /** 049 * Returns the mean rate at which events have occurred since the meter was created. 050 * @return the mean rate at which events have occurred since the meter was created 051 */ 052 double getMeanRate(); 053 054 /** 055 * Returns the one-minute exponentially-weighted moving average rate at which events have occurred 056 * since the meter was created. 057 * <p/> 058 * This rate has the same exponential decay factor as the one-minute load average in the {@code 059 * top} Unix command. 060 * @return the one-minute exponentially-weighted moving average rate at which events have occurred 061 * since the meter was created 062 */ 063 double getOneMinuteRate(); 064 065 /** 066 * Returns the five-minute exponentially-weighted moving average rate at which events have 067 * occurred since the meter was created. 068 * <p/> 069 * This rate has the same exponential decay factor as the five-minute load average in the {@code 070 * top} Unix command. 071 * @return the five-minute exponentially-weighted moving average rate at which events have 072 * occurred since the meter was created 073 */ 074 double getFiveMinuteRate(); 075 076 /** 077 * Returns the fifteen-minute exponentially-weighted moving average rate at which events have 078 * occurred since the meter was created. 079 * <p/> 080 * This rate has the same exponential decay factor as the fifteen-minute load average in the 081 * {@code top} Unix command. 082 * @return the fifteen-minute exponentially-weighted moving average rate at which events have 083 * occurred since the meter was created 084 */ 085 double getFifteenMinuteRate(); 086}