]>
Commit | Line | Data |
---|---|---|
44548e6a | 1 | Index: squid/src/stat.c |
2 | diff -c squid/src/stat.c:1.351.2.10 squid/src/stat.c:1.351.2.11 | |
3 | *** squid/src/stat.c:1.351.2.10 Sat Jul 17 14:09:23 2004 | |
4 | --- squid/src/stat.c Tue Dec 7 18:00:56 2004 | |
5 | *************** | |
6 | *** 58,64 **** | |
7 | static void statCountersClean(StatCounters *); | |
8 | static void statCountersCopy(StatCounters * dest, const StatCounters * orig); | |
9 | static double statMedianSvc(int, int); | |
10 | ! static void statStoreEntry(StoreEntry * s, StoreEntry * e); | |
11 | static double statCPUUsage(int minutes); | |
12 | static OBJH stat_io_get; | |
13 | static OBJH stat_objects_get; | |
14 | --- 58,64 ---- | |
15 | static void statCountersClean(StatCounters *); | |
16 | static void statCountersCopy(StatCounters * dest, const StatCounters * orig); | |
17 | static double statMedianSvc(int, int); | |
18 | ! static void statStoreEntry(MemBuf * mb, StoreEntry * e); | |
19 | static double statCPUUsage(int minutes); | |
20 | static OBJH stat_io_get; | |
21 | static OBJH stat_objects_get; | |
22 | *************** | |
23 | *** 254,308 **** | |
24 | } | |
25 | ||
26 | static void | |
27 | ! statStoreEntry(StoreEntry * s, StoreEntry * e) | |
28 | { | |
29 | MemObject *mem = e->mem_obj; | |
30 | int i; | |
31 | struct _store_client *sc; | |
32 | dlink_node *node; | |
33 | ! storeAppendPrintf(s, "KEY %s\n", storeKeyText(e->hash.key)); | |
34 | if (mem) | |
35 | ! storeAppendPrintf(s, "\t%s %s\n", | |
36 | RequestMethodStr[mem->method], mem->log_url); | |
37 | ! storeAppendPrintf(s, "\t%s\n", describeStatuses(e)); | |
38 | ! storeAppendPrintf(s, "\t%s\n", storeEntryFlags(e)); | |
39 | ! storeAppendPrintf(s, "\t%s\n", describeTimestamps(e)); | |
40 | ! storeAppendPrintf(s, "\t%d locks, %d clients, %d refs\n", | |
41 | (int) e->lock_count, | |
42 | storePendingNClients(e), | |
43 | (int) e->refcount); | |
44 | ! storeAppendPrintf(s, "\tSwap Dir %d, File %#08X\n", | |
45 | e->swap_dirn, e->swap_filen); | |
46 | if (mem != NULL) { | |
47 | ! storeAppendPrintf(s, "\tinmem_lo: %d\n", (int) mem->inmem_lo); | |
48 | ! storeAppendPrintf(s, "\tinmem_hi: %d\n", (int) mem->inmem_hi); | |
49 | ! storeAppendPrintf(s, "\tswapout: %d bytes queued\n", | |
50 | (int) mem->swapout.queue_offset); | |
51 | if (mem->swapout.sio) | |
52 | ! storeAppendPrintf(s, "\tswapout: %d bytes written\n", | |
53 | (int) storeOffset(mem->swapout.sio)); | |
54 | for (i = 0, node = mem->clients.head; node; node = node->next, i++) { | |
55 | sc = (store_client *) node->data; | |
56 | if (sc->callback_data == NULL) | |
57 | continue; | |
58 | ! storeAppendPrintf(s, "\tClient #%d, %p\n", i, sc->callback_data); | |
59 | ! storeAppendPrintf(s, "\t\tcopy_offset: %d\n", | |
60 | (int) sc->copy_offset); | |
61 | ! storeAppendPrintf(s, "\t\tseen_offset: %d\n", | |
62 | (int) sc->seen_offset); | |
63 | ! storeAppendPrintf(s, "\t\tcopy_size: %d\n", | |
64 | (int) sc->copy_size); | |
65 | ! storeAppendPrintf(s, "\t\tflags:"); | |
66 | if (sc->flags.disk_io_pending) | |
67 | ! storeAppendPrintf(s, " disk_io_pending"); | |
68 | if (sc->flags.store_copying) | |
69 | ! storeAppendPrintf(s, " store_copying"); | |
70 | if (sc->flags.copy_event_pending) | |
71 | ! storeAppendPrintf(s, " copy_event_pending"); | |
72 | ! storeAppendPrintf(s, "\n"); | |
73 | } | |
74 | } | |
75 | ! storeAppendPrintf(s, "\n"); | |
76 | } | |
77 | ||
78 | /* process objects list */ | |
79 | --- 254,308 ---- | |
80 | } | |
81 | ||
82 | static void | |
83 | ! statStoreEntry(MemBuf * mb, StoreEntry * e) | |
84 | { | |
85 | MemObject *mem = e->mem_obj; | |
86 | int i; | |
87 | struct _store_client *sc; | |
88 | dlink_node *node; | |
89 | ! memBufPrintf(mb, "KEY %s\n", storeKeyText(e->hash.key)); | |
90 | if (mem) | |
91 | ! memBufPrintf(mb, "\t%s %s\n", | |
92 | RequestMethodStr[mem->method], mem->log_url); | |
93 | ! memBufPrintf(mb, "\t%s\n", describeStatuses(e)); | |
94 | ! memBufPrintf(mb, "\t%s\n", storeEntryFlags(e)); | |
95 | ! memBufPrintf(mb, "\t%s\n", describeTimestamps(e)); | |
96 | ! memBufPrintf(mb, "\t%d locks, %d clients, %d refs\n", | |
97 | (int) e->lock_count, | |
98 | storePendingNClients(e), | |
99 | (int) e->refcount); | |
100 | ! memBufPrintf(mb, "\tSwap Dir %d, File %#08X\n", | |
101 | e->swap_dirn, e->swap_filen); | |
102 | if (mem != NULL) { | |
103 | ! memBufPrintf(mb, "\tinmem_lo: %d\n", (int) mem->inmem_lo); | |
104 | ! memBufPrintf(mb, "\tinmem_hi: %d\n", (int) mem->inmem_hi); | |
105 | ! memBufPrintf(mb, "\tswapout: %d bytes queued\n", | |
106 | (int) mem->swapout.queue_offset); | |
107 | if (mem->swapout.sio) | |
108 | ! memBufPrintf(mb, "\tswapout: %d bytes written\n", | |
109 | (int) storeOffset(mem->swapout.sio)); | |
110 | for (i = 0, node = mem->clients.head; node; node = node->next, i++) { | |
111 | sc = (store_client *) node->data; | |
112 | if (sc->callback_data == NULL) | |
113 | continue; | |
114 | ! memBufPrintf(mb, "\tClient #%d, %p\n", i, sc->callback_data); | |
115 | ! memBufPrintf(mb, "\t\tcopy_offset: %d\n", | |
116 | (int) sc->copy_offset); | |
117 | ! memBufPrintf(mb, "\t\tseen_offset: %d\n", | |
118 | (int) sc->seen_offset); | |
119 | ! memBufPrintf(mb, "\t\tcopy_size: %d\n", | |
120 | (int) sc->copy_size); | |
121 | ! memBufPrintf(mb, "\t\tflags:"); | |
122 | if (sc->flags.disk_io_pending) | |
123 | ! memBufPrintf(mb, " disk_io_pending"); | |
124 | if (sc->flags.store_copying) | |
125 | ! memBufPrintf(mb, " store_copying"); | |
126 | if (sc->flags.copy_event_pending) | |
127 | ! memBufPrintf(mb, " copy_event_pending"); | |
128 | ! memBufPrintf(mb, "\n"); | |
129 | } | |
130 | } | |
131 | ! memBufPrintf(mb, "\n"); | |
132 | } | |
133 | ||
134 | /* process objects list */ | |
135 | *************** | |
136 | *** 326,344 **** | |
137 | eventAdd("statObjects", statObjects, state, 0.1, 1); | |
138 | return; | |
139 | } | |
140 | - storeBuffer(state->sentry); | |
141 | debug(49, 3) ("statObjects: Bucket #%d\n", state->bucket); | |
142 | link_next = hash_get_bucket(store_table, state->bucket); | |
143 | ! while (NULL != (link_ptr = link_next)) { | |
144 | ! link_next = link_ptr->next; | |
145 | ! e = (StoreEntry *) link_ptr; | |
146 | ! if (state->filter && 0 == state->filter(e)) | |
147 | ! continue; | |
148 | ! statStoreEntry(state->sentry, e); | |
149 | } | |
150 | state->bucket++; | |
151 | eventAdd("statObjects", statObjects, state, 0.0, 1); | |
152 | - storeBufferFlush(state->sentry); | |
153 | } | |
154 | ||
155 | static void | |
156 | --- 326,348 ---- | |
157 | eventAdd("statObjects", statObjects, state, 0.1, 1); | |
158 | return; | |
159 | } | |
160 | debug(49, 3) ("statObjects: Bucket #%d\n", state->bucket); | |
161 | link_next = hash_get_bucket(store_table, state->bucket); | |
162 | ! if (link_next) { | |
163 | ! MemBuf mb; | |
164 | ! memBufDefInit(&mb); | |
165 | ! while (NULL != (link_ptr = link_next)) { | |
166 | ! link_next = link_ptr->next; | |
167 | ! e = (StoreEntry *) link_ptr; | |
168 | ! if (state->filter && 0 == state->filter(e)) | |
169 | ! continue; | |
170 | ! statStoreEntry(&mb, e); | |
171 | ! } | |
172 | ! storeAppend(state->sentry, mb.buf, mb.size); | |
173 | ! memBufClean(&mb); | |
174 | } | |
175 | state->bucket++; | |
176 | eventAdd("statObjects", statObjects, state, 0.0, 1); | |
177 | } | |
178 | ||
179 | static void |