home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / j2sdk / files / linux / j2sdklin.bin / jdk1.3.1 / include-old / alloc_cache.h next >
Encoding:
C/C++ Source or Header  |  2001-05-06  |  1.4 KB  |  54 lines

  1. /*
  2.  * @(#)alloc_cache.h    1.10 00/02/02
  3.  *
  4.  * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the proprietary information of Sun Microsystems, Inc.  
  7.  * Use is subject to license terms.
  8.  * 
  9.  */
  10.  
  11. /*
  12.  * Per-thread allocation cache
  13.  */
  14.  
  15. #ifndef _JAVASOFT_ALLOC_CACHE_H_
  16. #define _JAVASOFT_ALLOC_CACHE_H_
  17.  
  18. /* Default cache (refill) size */
  19. #define    ALLOC_CACHE_SIZE    1024
  20. /* Default maximum local allocation size, must be less than cache size */
  21. #define    ALLOC_LOCAL_SIZE    (ALLOC_CACHE_SIZE/4)
  22. /* Default handle cache refill count */
  23. #define    ALLOC_HANDLE_COUNT    (ALLOC_CACHE_SIZE/8/3)
  24.  
  25. /*
  26.  * Per-thread structure. Many fields are defined to be volatile because
  27.  * they are manipulated by multiple threads outside of lock protection.
  28.  */
  29. struct alloc_cache {
  30.     volatile int     cache_busy;
  31.     volatile long    cache_size;
  32.     void    * volatile cache_tail;
  33.     void    * volatile cache_handles;
  34.     /* Meters: leave in for now */
  35.     long    cache_allocations;
  36.     long    cache_block_fills;
  37.     long    cache_handle_fills;
  38. };
  39.  
  40. /* Cache (refill) size */
  41. extern int allocCacheSize;
  42.  
  43. /* Allocations smaller than this are attempted from local cache.  Use
  44.    0 to turn off local allocation.  Must be less than cache size. */
  45. extern int allocLocalSize;
  46.  
  47. /* Cache handle refill count */
  48. extern int allocHandleCount;
  49.  
  50. /* Callback when thread exits */
  51. extern void allocCacheCleanup(struct alloc_cache *);
  52.  
  53. #endif /* !_JAVASOFT_ALLOC_CACHE_H_ */
  54.