1/*--------------------------------------------------------------------*/
2/*--- Callgrind cost array interface.                      costs.h ---*/
3/*--------------------------------------------------------------------*/
4
5/*
6   This file is part of Valgrind, a dynamic binary instrumentation
7   framework.
8
9   Copyright (C) 2004-2017 Josef Weidendorfer
10      josef.weidendorfer@gmx.de
11
12   This program is free software; you can redistribute it and/or
13   modify it under the terms of the GNU General Public License as
14   published by the Free Software Foundation; either version 2 of the
15   License, or (at your option) any later version.
16
17   This program is distributed in the hope that it will be useful, but
18   WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20   General Public License for more details.
21
22   You should have received a copy of the GNU General Public License
23   along with this program; if not, write to the Free Software
24   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25   02111-1307, USA.
26
27   The GNU General Public License is contained in the file COPYING.
28*/
29
30
31#ifndef CLG_COSTS
32#define CLG_COSTS
33
34#include "pub_tool_basics.h"
35
36#define CLG_(str) VGAPPEND(vgCallgrind_,str)
37
38extern UInt CLG_(costarray_entries);
39extern UInt CLG_(costarray_chunks);
40
41/* Array of 64bit costs. This is separated from other structs
42 * to support a dynamic number of costs for a cost item.
43 * Chunks are allocated on demand.
44 */
45typedef struct _CostChunk CostChunk;
46struct _CostChunk {
47  Int size;
48  Int used;
49  CostChunk *next, *prev;
50  ULong data[0];
51};
52
53/* Allocate a number of 64bit cost values.
54 * Typically used from ct_events.c */
55ULong* CLG_(get_costarray)(Int size);
56
57#endif /* CLG_COSTS */
58