Skip to content

Commit

Permalink
Introduce trace macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja committed May 27, 2016
1 parent 03d1dd6 commit 660d82d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/XrdFileCache/XrdFileCache.cc
Expand Up @@ -28,18 +28,19 @@
#include "XrdOss/XrdOss.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucUtils.hh"
#include "XrdOuc/XrdOucTrace.hh"

#include "XrdFileCache.hh"
#include "XrdFileCacheTrace.hh"
#include "XrdFileCacheInfo.hh"
#include "XrdFileCacheIOEntireFile.hh"
#include "XrdFileCacheIOFileBlock.hh"

using namespace XrdFileCache;



Cache * Cache::m_factory = NULL;


void *CacheDirCleanupThread(void* cache_void)
{
Cache::GetInstance().CacheDirCleanup();
Expand Down Expand Up @@ -131,9 +132,12 @@ bool Cache::Decide(XrdOucCacheIO* io)

Cache::Cache() : XrdOucCache(),
m_log(0, "XrdFileCache_"),
m_trace(0),
m_traceID("Manager"),
m_prefetch_condVar(0),
m_RAMblocks_used(0)
{
m_trace = new XrdOucTrace(&m_log);
}

//______________________________________________________________________________
Expand Down
6 changes: 6 additions & 0 deletions src/XrdFileCache/XrdFileCache.hh
Expand Up @@ -30,6 +30,7 @@

class XrdOucStream;
class XrdSysError;
class XrdOucTrace;

namespace XrdCl {
class Log;
Expand Down Expand Up @@ -190,13 +191,18 @@ namespace XrdFileCache

void AddActive(IO*, File*);


XrdOucTrace* GetTrace() { return m_trace; }
private:
bool ConfigParameters(std::string, XrdOucStream&);
bool ConfigXeq(char *, XrdOucStream &);
bool xdlib(XrdOucStream &);
static Cache *m_factory; //!< this object

XrdSysError m_log; //!< XrdFileCache namespace logger
XrdOucTrace* m_trace;
const char* m_traceID;

XrdOucCacheStats m_stats; //!<
XrdOss *m_output_fs; //!< disk cache file system

Expand Down
7 changes: 4 additions & 3 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -18,7 +18,7 @@


#include "XrdFileCacheFile.hh"

#include "XrdFileCacheTrace.hh"

#include <stdio.h>
#include <sstream>
Expand All @@ -40,6 +40,7 @@

using namespace XrdFileCache;


namespace XrdPosixGlobals
{
extern XrdScheduler *schedP;
Expand Down Expand Up @@ -80,7 +81,6 @@ m_offset(iOffset),
m_fileSize(iFileSize),
m_stopping(false),
m_stateCond(0), // We will explicitly lock the condition before use.

m_syncer(new DiskSyncer(this, "XrdFileCache::DiskSyncer")),
m_non_flushed_cnt(0),
m_in_sync(false),
Expand All @@ -89,7 +89,8 @@ m_prefetchState(kOn),
m_prefetchReadCnt(0),
m_prefetchHitCnt(0),
m_prefetchScore(1),
m_prefetchCurrentCnt(0)
m_prefetchCurrentCnt(0),
m_traceID("File")
{
clLog()->Debug(XrdCl::AppMsg, "File::File() %s", m_temp_filename.c_str());
if (!Open()) {
Expand Down
1 change: 1 addition & 0 deletions src/XrdFileCache/XrdFileCacheFile.hh
Expand Up @@ -140,6 +140,7 @@ namespace XrdFileCache
float m_prefetchScore; //cached
int m_prefetchCurrentCnt;

const char* m_traceID;

public:
//------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/XrdFileCache/XrdFileCacheIO.hh
Expand Up @@ -14,7 +14,7 @@ namespace XrdFileCache
{
public:
IO (XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache) :
m_io(io), m_statsGlobal(stats), m_cache(cache) {}
m_io(io), m_statsGlobal(stats), m_cache(cache), m_traceID("IO"){}

//! Original data source.
virtual XrdOucCacheIO *Base() { return m_io; }
Expand Down Expand Up @@ -42,6 +42,8 @@ namespace XrdFileCache
XrdOucCacheIO2 *m_io; //!< original data source
XrdOucCacheStats &m_statsGlobal; //!< reference to Cache statistics
Cache &m_cache; //!< reference to Cache needed in detach

const char* m_traceID;
};
}

Expand Down

0 comments on commit 660d82d

Please sign in to comment.