su_alloc_stat.h 2.49 KB
Newer Older
Pekka Pessi's avatar
Pekka Pessi committed
1 2 3 4 5 6 7
/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2005 Nokia Corporation.
 *
 * Contact: Pekka Pessi <pekka.pessi@nokia.com>
 *
8
 * This library is free software; you can redistribute it and/or
Pekka Pessi's avatar
Pekka Pessi committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

Pekka Pessi's avatar
Pekka Pessi committed
25 26
#ifndef SU_ALLOC_STAT_H
/** Defined when <sofia-sip/su_alloc_stat.h> has been included. */
27
#define SU_ALLOC_STAT_H
Pekka Pessi's avatar
Pekka Pessi committed
28

Pekka Pessi's avatar
Pekka Pessi committed
29 30
/**@ingroup su_alloc
 *
Pekka Pessi's avatar
Pekka Pessi committed
31
 * @file sofia-sip/su_alloc_stat.h Home-based memory management statistics
Pekka Pessi's avatar
Pekka Pessi committed
32 33
 *
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
34
 *
Pekka Pessi's avatar
Pekka Pessi committed
35 36 37 38
 * @date Created: Tue Apr  9 10:24:05 2002 ppessi
 */

#ifndef SU_ALLOC_H
39
#include <sofia-sip/su_alloc.h>
Pekka Pessi's avatar
Pekka Pessi committed
40 41 42
#endif

#ifndef SU_TYPES_H
43
#include <sofia-sip/su_types.h>
Pekka Pessi's avatar
Pekka Pessi committed
44 45
#endif

46 47
SOFIA_BEGIN_DECLS

Pekka Pessi's avatar
Pekka Pessi committed
48 49 50
typedef struct su_home_stat_t su_home_stat_t;

SU_DLL void su_home_init_stats(su_home_t *h);
51
SU_DLL void su_home_get_stats(su_home_t *, int include_clones,
52
			      su_home_stat_t *stats, isize_t statssize);
Pekka Pessi's avatar
Pekka Pessi committed
53

54
SU_DLL void su_home_stat_add(su_home_stat_t *total,
Pekka Pessi's avatar
Pekka Pessi committed
55 56 57 58 59
			     su_home_stat_t const *hs);

struct su_home_stat_t
{
  int      hs_size;
60 61 62
  usize_t hs_clones;		/**< Number of clones */
  usize_t hs_rehash;		/**< Number of (re)allocations of hash table. */
  usize_t hs_blocksize; 	/**< Current size of hash table */
63 64 65 66 67 68

  struct {
    unsigned hsp_size;		/**< Size of preload area */
    unsigned hsp_used;		/**< Number of bytes used from preload */
  } hs_preload;

Pekka Pessi's avatar
Pekka Pessi committed
69 70 71 72 73
  struct {
    uint64_t hsa_number;
    uint64_t hsa_bytes;
    uint64_t hsa_rbytes;
    uint64_t hsa_maxrbytes;
74
    uint64_t hsa_preload;	/**< Number of allocations from preload area */
Pekka Pessi's avatar
Pekka Pessi committed
75
  } hs_allocs;
76

Pekka Pessi's avatar
Pekka Pessi committed
77 78 79 80
  struct {
    uint64_t hsf_number;
    uint64_t hsf_bytes;
    uint64_t hsf_rbytes;
81
    uint64_t hsf_preload;	/**< Number of free()s from preload area */
Pekka Pessi's avatar
Pekka Pessi committed
82
  } hs_frees;
83

Pekka Pessi's avatar
Pekka Pessi committed
84 85 86 87 88 89 90
  struct {
    uint64_t hsb_number;
    uint64_t hsb_bytes;
    uint64_t hsb_rbytes;
  } hs_blocks;
};

91 92
SOFIA_END_DECLS

Pekka Pessi's avatar
Pekka Pessi committed
93
#endif /* ! defined(SU_ALLOC_H) */