XrdOfsStats.cc

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /*                                                                            */
00003 /*                        X r d O f s S t a t s . c c                         */
00004 /*                                                                            */
00005 /* (c) 2009 by the Board of Trustees of the Leland Stanford, Jr., University  */
00006 /*       All Rights Reserved. See XrdInfo.cc for complete License Terms       */
00007 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00008 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00009 /******************************************************************************/
00010 
00011 //          $Id: XrdOfsStats.cc 30949 2009-11-02 16:37:58Z ganis $
00012 
00013 const char *XrdOfsStatsCVSID = "$Id: XrdOfsStats.cc 30949 2009-11-02 16:37:58Z ganis $";
00014 
00015 #include <stdio.h>
00016 
00017 #include "XrdOfs/XrdOfsStats.hh"
00018 
00019 /******************************************************************************/
00020 /*                                R e p o r t                                 */
00021 /******************************************************************************/
00022   
00023 int XrdOfsStats::Report(char *buff, int blen)
00024 {
00025     static const char stats1[] = "<stats id=\"ofs\"><role>%s</role>"
00026            "<opr>%d</opr><opw>%d</opw><opp>%d</opp><ups>%d</ups><han>%d</han>"
00027            "<rdr>%d</rdr><bxq>%d</bxq><rep>%d</rep><err>%d</err><dly>%d</dly>"
00028            "<sok>%d</sok><ser>%d</ser></stats>";
00029     static const int  statsz = sizeof(stats1) + (12*10) + 64;
00030 
00031     StatsData myData;
00032 
00033 // If only the size is wanted, return the size
00034 //
00035    if (!buff) return statsz;
00036 
00037 // Make sure buffer is large enough
00038 //
00039    if (blen < statsz) return 0;
00040 
00041 // Get a copy of the statistics
00042 //
00043    sdMutex.Lock();
00044    myData = Data;
00045    sdMutex.UnLock();
00046 
00047 // Format the buffer
00048 //
00049    return sprintf(buff, stats1, myRole, myData.numOpenR,   myData.numOpenW,
00050                     myData.numOpenP,    myData.numUnpsist, myData.numHandles,
00051                     myData.numRedirect, myData.numStarted, myData.numReplies,
00052                     myData.numErrors,   myData.numDelays,
00053                     myData.numSeventOK, myData.numSeventER);
00054 }

Generated on Tue Jul 5 14:46:45 2011 for ROOT_528-00b_version by  doxygen 1.5.1