4 * Display memory usage of GNU Shogi data structures.
6 * ----------------------------------------------------------------------
7 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
8 * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
9 * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation
11 * GNU SHOGI is based on GNU CHESS
13 * Copyright (c) 1988, 1989, 1990 John Stanback
14 * Copyright (c) 1992 Free Software Foundation
16 * This file is part of GNU SHOGI.
18 * GNU Shogi is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License as published by the
20 * Free Software Foundation; either version 3 of the License,
21 * or (at your option) any later version.
23 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
24 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 * You should have received a copy of the GNU General Public License along
29 * with GNU Shogi; see the file COPYING. If not, see
30 * <http://www.gnu.org/licenses/>.
31 * ----------------------------------------------------------------------
37 /*unsigned*/ short rehash
; /* -1 is used as a flag --tpm */
40 main(int argc
, char **argv
)
46 l
= (long)sizeof(struct hashentry
);
47 n
= (int)((l
* (ttblsz
+ rehash
) * 2) / 1000);
48 printf("ttable:\t\t%4d\tkByte\t[hashentry:%ld "
49 "* (ttblsz:%d + rehash:%d) * 2]\n",
50 n
, l
, ttblsz
, rehash
);
54 l
= (long)sizeof(struct etable
);
55 n
= (int)((l
* (size_t)ETABLE
) / 1000);
60 printf("etab:\t\t%4d\tkByte\t[etable:%ld ETABLE:%d]\n",
63 l
= (long)sizeof(struct leaf
);
64 n
= (int)(l
* TREE
/ 1000);
65 printf("Tree:\t\t%4d\tkByte\t[leaf:%ld * TREE:%d]\n",
69 n
= (int)(sizeof_history
/ 1000);
74 printf("history:\t%4d\tkByte\t[unsigned short:%lu "
75 "* HISTORY_SIZE:%ld]\n",
76 n
, sizeof(unsigned short), (long)HISTORY_SIZE
);
79 l
= (long)sizeof(next_array
);
80 n
= (int)((l
* NO_PTYPE_PIECES
) / 1000);
82 printf("nextpos:\t%4d\tkByte\t[next_array:%ld "
83 "* NO_PTYPE_PIECES:%d]\n",
84 n
, l
, NO_PTYPE_PIECES
);
86 l
= (long)sizeof(next_array
);
87 n
= (int)((l
* NO_PTYPE_PIECES
) / 1000);
88 printf("nextdir:\t%4d\tkByte\t[next_array:%ld "
89 "* NO_PTYPE_PIECES:%d]\n",
90 n
, l
, NO_PTYPE_PIECES
);
94 n
= (int)(sizeof(distdata_array
) / 1000);
95 printf("distdata:\t%4d\tkByte\n", n
);
98 #ifndef SAVE_PTYPE_DISTDATA
99 l
= (long)sizeof(distdata_array
);
100 n
= (int)((l
* NO_PTYPE_PIECES
) / 1000);
101 printf("ptype_distdata:\t%4d\tkByte\t[distdata_array:%ld "
102 "* NO_PTYPE_PIECES:%d]\n",
103 n
, l
, NO_PTYPE_PIECES
);
106 l
= (long)sizeof(hashcode_array
);
108 printf("hashcode:\t%4d\tkByte\t[hashval:%ld]\n",
109 n
, (long)sizeof(struct hashval
));
111 l
= (long)sizeof(drop_hashcode_array
);
113 printf("drop_hashcode:\t%4d\tkByte\t[hashval:%ld]\n",
114 n
, (long)sizeof(struct hashval
));
116 l
= (long)sizeof(value_array
);
118 printf("value:\t\t%4d\tkByte\n", n
);
120 l
= (long)sizeof(fscore_array
);
122 printf("fscore:\t\t%4d\tkByte\n", n
);