]> git.ipfire.org Git - thirdparty/squid.git/blame - src/fs/coss/StoreFScoss.cc
Removed CVS $ markers
[thirdparty/squid.git] / src / fs / coss / StoreFScoss.cc
CommitLineData
59b2d47f 1/*
59b2d47f 2 * DEBUG: section 47 Store Directory Routines
3 * AUTHOR: Robert Collins
4 *
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
7 *
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.
16 *
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.
26ac0430 21 *
59b2d47f 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.
26ac0430 26 *
59b2d47f 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.
30 *
31 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
32 */
33
f7f3304a 34#include "squid.h"
59b2d47f 35#include "StoreFileSystem.h"
b9ae18aa 36#include "StoreFScoss.h"
8822ebee 37#include "mgr/Registration.h"
1a224843 38#include "Store.h"
b9ae18aa 39#include "CossSwapDir.h"
40#include "store_coss.h"
59b2d47f 41
42StoreFScoss StoreFScoss::_instance;
43
b9ae18aa 44StoreFScoss &
59b2d47f 45StoreFScoss::GetInstance()
46{
47 return _instance;
48}
49
50StoreFScoss::StoreFScoss()
51{
52 FsAdd(*this);
6852be71 53 registerWithCacheManager();
59b2d47f 54}
55
56char const *
57StoreFScoss::type() const
58{
59 return "coss";
60}
61
62void
63StoreFScoss::done()
64{
b001e822 65 /* delete coss_index_pool;coss_index_pool = NULL; XXX Should be here? */
59b2d47f 66 initialised = false;
67}
68
69SwapDir *
70StoreFScoss::createSwapDir()
71{
72 SwapDir *result = new CossSwapDir;
73 return result;
74}
75
59b2d47f 76void
77StoreFScoss::setup()
78{
79 assert(!initialised);
80
04eb0689 81 coss_index_pool = memPoolCreate("COSS index data", sizeof(CossIndexNode));
59b2d47f 82 initialised = true;
83}
1a224843 84
62ee09ca 85void
15fab853 86StoreFScoss::registerWithCacheManager()
62ee09ca 87{
8822ebee 88 Mgr::RegisterAction("coss", "COSS Stats", Stats, 0, 1);
62ee09ca 89}
90
b9ae18aa 91void
92StoreFScoss::Stats(StoreEntry * sentry)
93{
94 GetInstance().stat(sentry);
95}
96
97void
98StoreFScoss::stat(StoreEntry *sentry)
99{
100 stats.stat(sentry);
101}
102
103void
104CossStats::stat(StoreEntry *sentry)
1a224843 105{
106 const char *tbl_fmt = "%10s %10d %10d %10d\n";
107 storeAppendPrintf(sentry, "\n OPS SUCCESS FAIL\n");
108 storeAppendPrintf(sentry, tbl_fmt,
b9ae18aa 109 "open", open.ops, open.success, open.fail);
1a224843 110 storeAppendPrintf(sentry, tbl_fmt,
b9ae18aa 111 "create", create.ops, create.success, create.fail);
1a224843 112 storeAppendPrintf(sentry, tbl_fmt,
b9ae18aa 113 "close", close.ops, close.success, close.fail);
1a224843 114 storeAppendPrintf(sentry, tbl_fmt,
b9ae18aa 115 "unlink", unlink.ops, unlink.success, unlink.fail);
1a224843 116 storeAppendPrintf(sentry, tbl_fmt,
b9ae18aa 117 "read", read.ops, read.success, read.fail);
1a224843 118 storeAppendPrintf(sentry, tbl_fmt,
b9ae18aa 119 "write", write.ops, write.success, write.fail);
1a224843 120 storeAppendPrintf(sentry, tbl_fmt,
b9ae18aa 121 "s_write", stripe_write.ops, stripe_write.success, stripe_write.fail);
1a224843 122
123 storeAppendPrintf(sentry, "\n");
b9ae18aa 124 storeAppendPrintf(sentry, "stripes: %d\n", stripes);
125 storeAppendPrintf(sentry, "alloc.alloc: %d\n", alloc.alloc);
126 storeAppendPrintf(sentry, "alloc.realloc: %d\n", alloc.realloc);
127 storeAppendPrintf(sentry, "alloc.collisions: %d\n", alloc.collisions);
128 storeAppendPrintf(sentry, "disk_overflows: %d\n", disk_overflows);
129 storeAppendPrintf(sentry, "stripe_overflows: %d\n", stripe_overflows);
130 storeAppendPrintf(sentry, "open_mem_hits: %d\n", open_mem_hits);
131 storeAppendPrintf(sentry, "open_mem_misses: %d\n", open_mem_misses);
1a224843 132}