Return-Path: Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: (qmail 864 invoked from network); 4 Mar 2011 04:28:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Mar 2011 04:28:39 -0000 Received: (qmail 15916 invoked by uid 500); 4 Mar 2011 04:28:38 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 15894 invoked by uid 500); 4 Mar 2011 04:28:38 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 15885 invoked by uid 99); 4 Mar 2011 04:28:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 04:28:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Mar 2011 04:28:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A421123888CD; Fri, 4 Mar 2011 04:28:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1077551 - /hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileSystem.java Date: Fri, 04 Mar 2011 04:28:17 -0000 To: common-commits@hadoop.apache.org From: omalley@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110304042817.A421123888CD@eris.apache.org> Author: omalley Date: Fri Mar 4 04:28:17 2011 New Revision: 1077551 URL: http://svn.apache.org/viewvc?rev=1077551&view=rev Log: commit 59f5933c69bb62073833c1058eb6518f262d6940 Author: Suresh Srinivas Date: Fri Jul 16 10:29:17 2010 -0700 HADOOP-6859 from https://issues.apache.org/jira/secure/attachment/12449683/HADOOP-6859.y20.patch +++ b/YAHOO-CHANGES.txt + HADOOP-6859 - Introduce additional statistics to FileSystem to track + file system operations (suresh) + Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileSystem.java Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileSystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileSystem.java?rev=1077551&r1=1077550&r2=1077551&view=diff ============================================================================== --- hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileSystem.java (original) +++ hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FileSystem.java Fri Mar 4 04:28:17 2011 @@ -31,8 +31,8 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import java.util.regex.Pattern; import org.apache.commons.logging.*; @@ -1459,6 +1459,9 @@ public abstract class FileSystem extends private final String scheme; private AtomicLong bytesRead = new AtomicLong(); private AtomicLong bytesWritten = new AtomicLong(); + private AtomicInteger readOps = new AtomicInteger(); + private AtomicInteger largeReadOps = new AtomicInteger(); + private AtomicInteger writeOps = new AtomicInteger(); public Statistics(String scheme) { this.scheme = scheme; @@ -1481,6 +1484,30 @@ public abstract class FileSystem extends } /** + * Increment the number of read operations + * @param count number of read operations + */ + public void incrementReadOps(int count) { + readOps.getAndAdd(count); + } + + /** + * Increment the number of large read operations + * @param count number of large read operations + */ + public void incrementLargeReadOps(int count) { + largeReadOps.getAndAdd(count); + } + + /** + * Increment the number of write operations + * @param count number of write operations + */ + public void incrementWriteOps(int count) { + writeOps.getAndAdd(count); + } + + /** * Get the total number of bytes read * @return the number of bytes */ @@ -1496,9 +1523,36 @@ public abstract class FileSystem extends return bytesWritten.get(); } + /** + * Get the number of file system read operations such as list files + * @return number of read operations + */ + public int getReadOps() { + return readOps.get() + largeReadOps.get(); + } + + /** + * Get the number of large file system read operations such as list files + * under a large directory + * @return number of large read operations + */ + public int getLargeReadOps() { + return largeReadOps.get(); + } + + /** + * Get the number of file system write operations such as create, append + * rename etc. + * @return number of write operations + */ + public int getWriteOps() { + return writeOps.get(); + } + public String toString() { - return bytesRead + " bytes read and " + bytesWritten + - " bytes written"; + return bytesRead + " bytes read, " + bytesWritten + " bytes written, " + + readOps + " read ops, " + largeReadOps + " large read ops, " + + writeOps + " write ops"; } /**