1/**
2 * \file
3 * \brief internal functions
4 */
5
6/*
7 * Copyright (c) 2010, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef INTERNAL_H_
16#define INTERNAL_H_
17
18#include <stdio.h>
19#include <barrelfish/barrelfish.h>
20#include <skb/skb.h>
21#include <if/boot_perfmon_defs.h>
22#include <barrelfish/coreset.h>
23#include <bench/bench.h>
24
25#define MAX_COUNT 10
26
27struct timestamp {
28    cycles_t time[MAX_COUNT];
29};
30
31struct relations;
32
33extern int global_argc;
34extern char **global_argv;
35extern coreid_t my_core_id;
36extern struct relations *rel;
37extern struct coreset *set;
38extern struct timestamp *timestamp;
39
40typedef void (*callback)(void);
41typedef errval_t (*relations_iterator_fn)(void *st, coreid_t id,
42                                          struct boot_perfmon_binding *b);
43
44void exit_msg(struct boot_perfmon_binding *b);
45
46bool check_leader(void);
47coreid_t get_leader_id(void);
48errval_t set_leader(callback cb);
49
50errval_t relations_new(struct relations **retrel);
51errval_t relations_add(struct relations *rel, coreid_t id,
52                       struct boot_perfmon_binding *b);
53errval_t relations_remove(struct relations *rel, coreid_t id);
54errval_t relations_get(struct relations *rel, coreid_t id,
55                       struct boot_perfmon_binding **b);
56int relations_count(struct relations *rel);
57errval_t relations_iterate(struct relations *rel, void *st,
58                           relations_iterator_fn func);
59
60errval_t spawn(callback cb);
61
62errval_t connect(callback cb);
63
64errval_t tests(callback cb);
65void ping(struct boot_perfmon_binding *b, cycles_t time);
66void pong(struct boot_perfmon_binding *b, cycles_t time);
67
68#endif //INTERNAL_H_
69