]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mem/forward.h
Refactor memory pools statistics gathering (#1186)
[thirdparty/squid.git] / src / mem / forward.h
1 /*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /* DEBUG: section 13 High Level Memory Pool Management */
10
11 #ifndef _SQUID_SRC_MEM_FORWARD_H
12 #define _SQUID_SRC_MEM_FORWARD_H
13
14 #include "mem/AllocatorProxy.h"
15
16 #include <iosfwd>
17
18 class StoreEntry;
19
20 /// Memory Management
21 namespace Mem
22 {
23 class Meter;
24 class PoolMeter;
25 class PoolStats;
26
27 void Init();
28 void Stats(StoreEntry *);
29 void CleanIdlePools(void *unused);
30 void Report(std::ostream &);
31 void PoolReport(const PoolStats *, const PoolMeter *, std::ostream &);
32 };
33
34 extern const size_t squidSystemPageSize;
35
36 /// \deprecated use MEMPROXY_CLASS instead.
37 typedef void FREE(void *);
38
39 /// Types of memory pool which do not yet use MEMPROXY_CLASS() API
40 typedef enum {
41 MEM_NONE,
42 MEM_2K_BUF,
43 MEM_4K_BUF,
44 MEM_8K_BUF,
45 MEM_16K_BUF,
46 MEM_32K_BUF,
47 MEM_64K_BUF,
48 MEM_DREAD_CTRL,
49 MEM_DWRITE_Q,
50 MEM_MD5_DIGEST,
51 MEM_MAX
52 } mem_type;
53
54 /// Main cleanup handler.
55 void memClean(void);
56 void memInitModule(void);
57 void memCleanModule(void);
58 void memConfigure(void);
59 /// Allocate one element from the typed pool
60 void *memAllocate(mem_type);
61 void *memAllocString(size_t net_size, size_t * gross_size);
62 void *memAllocBuf(size_t net_size, size_t * gross_size);
63 void *memAllocRigid(size_t net_size);
64 void *memReallocBuf(void *buf, size_t net_size, size_t * gross_size);
65 /// Free a element allocated by memAllocate()
66 void memFree(void *, int type);
67 void memFreeString(size_t size, void *);
68 void memFreeBuf(size_t size, void *);
69 void memFreeRigid(void *, size_t net_size);
70 FREE *memFreeBufFunc(size_t size);
71 int memInUse(mem_type);
72 void memDataInit(mem_type, const char *, size_t, int, bool doZero = true);
73 void memCheckInit(void);
74 size_t memStringCount();
75
76 #endif /* _SQUID_SRC_MEM_FORWARD_H */
77