1/*
2 * Copyright (c) 2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_APACHE_LICENSE_HEADER_START@
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * @APPLE_APACHE_LICENSE_HEADER_END@
19 */
20/*
21    auto_tester.h
22    Copyright (c) 2008-2011 Apple Inc. All rights reserved.
23 */
24
25#ifndef AUTO_TESTER_H
26#define AUTO_TESTER_H
27
28__BEGIN_DECLS
29
30#ifdef AUTO_TESTER
31
32#include "auto_zone.h"
33
34typedef struct {
35    void (*auto_probe_auto_zone_collect)(auto_zone_options_t options);
36    void (*auto_probe_admin_deallocate)(void *address);
37    void (*auto_probe_begin_heap_scan)(boolean_t generational);
38    void (*auto_probe_begin_local_scan)();
39    void (*auto_probe_collection_complete)();
40    void (*auto_probe_end_heap_scan)(size_t garbage_count, void **garbage_blocks);
41    void (*auto_probe_end_local_scan)(size_t garbage_count, void **garbage_blocks);
42    void (*auto_scan_barrier)();
43    void (*auto_probe_end_thread_scan)();
44    void (*auto_probe_heap_collection_complete)();
45    void (*auto_probe_local_collection_complete)();
46    void (*auto_probe_mature)(void *address, unsigned char age);
47    void (*auto_probe_make_global)(void *address, unsigned char age);
48    void (*auto_probe_scan_range)(void *address, void *end);
49    void (*auto_probe_scan_with_layout)(void *address, void *end, const unsigned char *map);
50    void (*auto_probe_did_scan_with_layout)(void *address, void *end, const unsigned char *map);
51    void (*auto_probe_set_pending)(void *block);
52    void (*auto_probe_unregistered_thread_error)();
53} AutoProbeFunctions;
54
55extern AutoProbeFunctions *auto_probe_functions;
56
57#define AUTO_PROBE(probe_func) do { if (auto_probe_functions) auto_probe_functions->probe_func; } while (0)
58
59#else /* AUTO_TESTER */
60
61typedef struct AutoProbeFunctions AutoProbeFunctions;
62#define AUTO_PROBE(probe_func)
63
64#endif /* AUTO_TESTER */
65
66AUTO_EXPORT bool auto_set_probe_functions(AutoProbeFunctions *func)
67    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
68
69__END_DECLS
70
71#endif /* AUTO_TESTER_H */
72