1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-
+
|
/*
* tclThreadAlloc.c --
*
* This is a very fast storage allocator for used with threads (designed
* avoid lock contention). The basic strategy is to allocate memory in
* fixed size blocks from block caches.
*
* The Initial Developer of the Original Code is America Online, Inc.
* Portions created by AOL are Copyright (C) 1999 America Online, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclThreadAlloc.c,v 1.4.2.6 2005/04/07 11:27:17 vasiljevic Exp $
* RCS: @(#) $Id: tclThreadAlloc.c,v 1.4.2.7 2005/12/20 22:16:34 dkf Exp $
*/
#include "tclInt.h"
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) && !defined(TCL_MEM_DEBUG)
#ifdef WIN32
|
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
-
-
-
-
-
-
+
+
+
+
+
+
|
/*
* The following structure defines a bucket of blocks with
* various accounting and statistics information.
*/
typedef struct Bucket {
Block *firstPtr;
int nfree;
int nget;
int nput;
int nwait;
int nlock;
int nrequest;
long nfree;
long nget;
long nput;
long nwait;
long nlock;
long nrequest;
} Bucket;
/*
* The following structure defines a cache of buckets and objs.
*/
typedef struct Cache {
|
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
|
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
|
-
-
+
+
|
if (cachePtr == sharedPtr) {
Tcl_DStringAppendElement(dsPtr, "shared");
} else {
sprintf(buf, "thread%d", (int) cachePtr->owner);
Tcl_DStringAppendElement(dsPtr, buf);
}
for (n = 0; n < NBUCKETS; ++n) {
sprintf(buf, "%d %d %d %d %d %d %d",
(int) binfo[n].blocksize,
sprintf(buf, "%lu %ld %ld %ld %ld %ld %ld",
(unsigned long) binfo[n].blocksize,
cachePtr->buckets[n].nfree,
cachePtr->buckets[n].nget,
cachePtr->buckets[n].nput,
cachePtr->buckets[n].nrequest,
cachePtr->buckets[n].nlock,
cachePtr->buckets[n].nwait);
Tcl_DStringAppendElement(dsPtr, buf);
|