]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc
e7793d1b8e5f212e7d862069996f68187a085eef
3 * $Id: DiskDaemonDiskIOModule.cc,v 1.4 2007/04/12 19:37:24 wessels Exp $
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
31 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
35 #include "DiskDaemonDiskIOModule.h"
36 #include "CacheManager.h"
37 #include "DiskdIOStrategy.h"
40 DiskDaemonDiskIOModule::DiskDaemonDiskIOModule() : initialised(false)
45 DiskDaemonDiskIOModule
&
46 DiskDaemonDiskIOModule::GetInstance()
52 DiskDaemonDiskIOModule::init()
54 /* We may be reused - for instance in coss - eventually.
55 * When we do, we either need per-using-module stats (
56 * no singleton pattern), or we need to refcount the
57 * initialisation level and handle multiple clients.
61 memset(&diskd_stats
, '\0', sizeof(diskd_stats
));
65 * No debugging here please because this method is called before
66 * the debug log is configured and we'll get the message on
67 * stderr when doing things like 'squid -k reconfigure'
69 debugs(47, 1, "diskd started");
73 registerWithCacheManager();
77 DiskDaemonDiskIOModule::registerWithCacheManager(void)
79 CacheManager::GetInstance()->registerAction("diskd", "DISKD Stats", Stats
, 0, 1);
83 DiskDaemonDiskIOModule::shutdown()
89 DiskDaemonDiskIOModule::createStrategy()
91 return new DiskdIOStrategy();
94 DiskDaemonDiskIOModule
DiskDaemonDiskIOModule::Instance
;
97 DiskDaemonDiskIOModule::Stats(StoreEntry
* sentry
)
99 storeAppendPrintf(sentry
, "sent_count: %d\n", diskd_stats
.sent_count
);
100 storeAppendPrintf(sentry
, "recv_count: %d\n", diskd_stats
.recv_count
);
101 storeAppendPrintf(sentry
, "max_away: %d\n", diskd_stats
.max_away
);
102 storeAppendPrintf(sentry
, "max_shmuse: %d\n", diskd_stats
.max_shmuse
);
103 storeAppendPrintf(sentry
, "open_fail_queue_len: %d\n", diskd_stats
.open_fail_queue_len
);
104 storeAppendPrintf(sentry
, "block_queue_len: %d\n", diskd_stats
.block_queue_len
);
105 diskd_stats
.max_away
= diskd_stats
.max_shmuse
= 0;
106 storeAppendPrintf(sentry
, "\n OPS SUCCESS FAIL\n");
107 storeAppendPrintf(sentry
, "%7s %9d %9d %7d\n",
108 "open", diskd_stats
.open
.ops
, diskd_stats
.open
.success
, diskd_stats
.open
.fail
);
109 storeAppendPrintf(sentry
, "%7s %9d %9d %7d\n",
110 "create", diskd_stats
.create
.ops
, diskd_stats
.create
.success
, diskd_stats
.create
.fail
);
111 storeAppendPrintf(sentry
, "%7s %9d %9d %7d\n",
112 "close", diskd_stats
.close
.ops
, diskd_stats
.close
.success
, diskd_stats
.close
.fail
);
113 storeAppendPrintf(sentry
, "%7s %9d %9d %7d\n",
114 "unlink", diskd_stats
.unlink
.ops
, diskd_stats
.unlink
.success
, diskd_stats
.unlink
.fail
);
115 storeAppendPrintf(sentry
, "%7s %9d %9d %7d\n",
116 "read", diskd_stats
.read
.ops
, diskd_stats
.read
.success
, diskd_stats
.read
.fail
);
117 storeAppendPrintf(sentry
, "%7s %9d %9d %7d\n",
118 "write", diskd_stats
.write
.ops
, diskd_stats
.write
.success
, diskd_stats
.write
.fail
);
122 DiskDaemonDiskIOModule::type () const