4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
38 typedef struct hentry
{
39 struct hentry
*next
; /* next entry in hash chain */
40 struct hentry
*prev
; /* previous entry in hash chain */
41 char *lib
; /* library name */
42 char *key
; /* hash key (function name) */
43 unsigned long count
; /* number of occurances of fn */
46 typedef struct hashb
{
47 hentry_t
*first
; /* first entry in bucket */
48 mutex_t block
; /* bucket lock */
52 unsigned int size
; /* size of tbl in buckets */
53 hashb_t
*tbl
; /* ptr to buckets */
56 typedef struct hiter
{
57 int bucket
; /* bucket in current iteration */
58 hentry_t
*next
; /* next entry in iteration */
59 htbl_t
*table
; /* ptr to table */
63 * HD_hashntry specifies that the entry written to disk contains information
64 * about function calls and is stored in the hash table. When read back from
65 * disk this is merged into the parent's hash table
67 * HD_cts_syscts specifies that the entry written to disk is a struct counts
68 * struct syscount pair. This contains information about system calls,
69 * signals, and faults. When read back from disk, the information is added
70 * to the struct count / struct syscount information kept by the parent.
73 typedef enum hdtype
{ HD_hashntry
, HD_cts_syscts
} hdtype_t
;
75 typedef struct hdntry
{
76 hdtype_t type
; /* type of entry we've written to disk */
77 size_t sz_lib
; /* size of library string on disk */
78 size_t sz_key
; /* size of key string on disk */
79 unsigned long count
; /* count of occurrances of key */
83 extern htbl_t
*init_hash(unsigned int);
84 extern void destroy_hash(htbl_t
*);
85 extern hiter_t
*iterate_hash(htbl_t
*);
86 extern hentry_t
*iter_next(hiter_t
*);
87 extern void iter_free(hiter_t
*);
88 extern void add_fcall(htbl_t
*, char *, char *, unsigned long);
89 extern size_t elements_in_table(htbl_t
*);