Skip to content

Commit

Permalink
nfs: add -c option to statics command to reset counters
Browse files Browse the repository at this point in the history
Acked-by: Gerd Behrmann
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Nov 15, 2013
1 parent d73114f commit 71c667a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Expand Up @@ -83,6 +83,7 @@
import org.dcache.nfs.vfs.Inode;
import org.dcache.nfs.vfs.VirtualFileSystem;
import org.dcache.chimera.nfsv41.mover.NFS4ProtocolInfo;
import org.dcache.commons.stats.RequestExecutionTimeGauges;
import org.dcache.commons.util.NDC;
import org.dcache.util.LoginBrokerHandler;
import org.dcache.util.RedirectedTransfer;
Expand Down Expand Up @@ -712,10 +713,19 @@ private static multipath_list4 toMultipath(InetSocketAddress[] addresses)
return multipath;
}

public final static String fh_stats =
"stats [-c] # show nfs requests statstics\n\n" +
" Print nfs operation statistics.\n" +
" -c clear current statistics values";
public final static String hh_stats = " [-c] # show nfs requests statstics";
public String ac_stats(Args args) {
RequestExecutionTimeGauges<String> gauges = _nfs4.getStatistics();
StringBuilder sb = new StringBuilder();
sb.append("Stats:").append("\n").append(_nfs4.getStatistics());
sb.append("Stats:").append("\n").append(gauges);

if (args.hasOption("c")) {
gauges.reset();
}
return sb.toString();
}
}
Expand Up @@ -27,6 +27,7 @@
import org.dcache.nfs.v4.NFS4Client;
import org.dcache.nfs.v4.NFSv41Session;
import org.dcache.nfs.v4.xdr.stateid4;
import org.dcache.commons.stats.RequestExecutionTimeGauges;
import org.dcache.pool.FaultAction;
import org.dcache.pool.FaultEvent;
import org.dcache.pool.FaultListener;
Expand Down Expand Up @@ -145,10 +146,20 @@ private InetSocketAddress[] localSocketAddresses(List<InetAddress> addresses, in
return socketAddresses;
}

public final static String hh_nfs_stats = " # show nfs mover statstics";
public final static String fh_nfs_stats =
"nfs stats [-c] # show nfs requests statstics\n\n" +
" Print nfs operation statistics.\n" +
" -c clear current statistics values";
public final static String hh_nfs_stats = " [-c] # show nfs mover statstics";
public String ac_nfs_stats(Args args) {

RequestExecutionTimeGauges<String> gauges = _nfsIO.getNFSServer().getStatistics();
StringBuilder sb = new StringBuilder();
sb.append("Stats:").append("\n").append(_nfsIO.getNFSServer().getStatistics());
sb.append("Stats:").append("\n").append(gauges);

if (args.hasOption("c")) {
gauges.reset();
}

return sb.toString();
}
Expand Down

0 comments on commit 71c667a

Please sign in to comment.