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 */ 018 019 package org.apache.hadoop.mapreduce; 020 021 import org.apache.hadoop.classification.InterfaceAudience; 022 import org.apache.hadoop.classification.InterfaceStability; 023 import org.apache.hadoop.io.Writable; 024 025 /** 026 * A named counter that tracks the progress of a map/reduce job. 027 * 028 * <p><code>Counters</code> represent global counters, defined either by the 029 * Map-Reduce framework or applications. Each <code>Counter</code> is named by 030 * an {@link Enum} and has a long for the value.</p> 031 * 032 * <p><code>Counters</code> are bunched into Groups, each comprising of 033 * counters from a particular <code>Enum</code> class. 034 */ 035 @InterfaceAudience.Public 036 @InterfaceStability.Stable 037 public interface Counter extends Writable { 038 039 /** 040 * Set the display name of the counter 041 * @param displayName of the counter 042 * @deprecated (and no-op by default) 043 */ 044 @Deprecated 045 void setDisplayName(String displayName); 046 047 /** 048 * @return the name of the counter 049 */ 050 String getName(); 051 052 /** 053 * Get the display name of the counter. 054 * @return the user facing name of the counter 055 */ 056 String getDisplayName(); 057 058 /** 059 * What is the current value of this counter? 060 * @return the current value 061 */ 062 long getValue(); 063 064 /** 065 * Set this counter by the given value 066 * @param value the value to set 067 */ 068 void setValue(long value); 069 070 /** 071 * Increment this counter by the given value 072 * @param incr the value to increase this counter by 073 */ 074 void increment(long incr); 075 }