1/**
2 * \file
3 * \brief Performace monitoring support for x86\
4 * This should be working on Intel and AMD platforms.
5 */
6
7/*
8 * Copyright (c) 2007, 2008, 2009, 2010, 2013, ETH Zurich.
9 * All rights reserved.
10 *
11 * This file is distributed under the terms in the attached LICENSE file.
12 * If you do not find this file, copies can be found by writing to:
13 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
14 */
15
16
17#ifndef BARRELFISH_KPI_PERFMON_H
18#define BARRELFISH_KPI_PERFMON_H
19
20#include <barrelfish_kpi/lmp.h>
21
22#define min_pm(a,b) ((a) < (b) ? (a) : (b))
23
24// LMP_MAX_LENGTH is given in words, need to convert to bytes.
25#define LMP_MAX_BYTES (LMP_MSG_LENGTH*sizeof(uint64_t)/sizeof(char))
26
27// Make sure the size of the struct does not exceed the maximum
28// length used for message transfer
29#define PERFMON_DATA_LEN (min_pm(DISP_NAME_LEN, LMP_MAX_BYTES))
30#define PERFMON_DISP_NAME_LEN (PERFMON_DATA_LEN-sizeof(uint64_t))
31
32struct perfmon_overflow_data {
33    uint64_t ip; // Instruction pointer when overflow was fired
34    char name[PERFMON_DISP_NAME_LEN]; // Name of the running task
35};
36
37#endif //BARRELFISH_KPI_PERFMON_H
38
39