1221633Spjd/**
2148456Spjd * \file
3148456Spjd * \brief Performace monitoring support for x86\
4148456Spjd * This should be working on Intel and AMD platforms.
5148456Spjd */
6148456Spjd
7148456Spjd/*
8148456Spjd * Copyright (c) 2007, 2008, 2009, 2010, 2013, ETH Zurich.
9148456Spjd * All rights reserved.
10148456Spjd *
11148456Spjd * This file is distributed under the terms in the attached LICENSE file.
12148456Spjd * If you do not find this file, copies can be found by writing to:
13148456Spjd * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
14148456Spjd */
15148456Spjd
16148456Spjd
17148456Spjd#ifndef BARRELFISH_KPI_PERFMON_H
18148456Spjd#define BARRELFISH_KPI_PERFMON_H
19148456Spjd
20148456Spjd#include <barrelfish_kpi/lmp.h>
21148456Spjd
22148456Spjd#define min_pm(a,b) ((a) < (b) ? (a) : (b))
23148456Spjd
24148456Spjd// LMP_MAX_LENGTH is given in words, need to convert to bytes.
25148456Spjd#define LMP_MAX_BYTES (LMP_MSG_LENGTH*sizeof(uint64_t)/sizeof(char))
26148456Spjd
27255977Spluknet// Make sure the size of the struct does not exceed the maximum
28148456Spjd// length used for message transfer
29148456Spjd#define PERFMON_DATA_LEN (min_pm(DISP_NAME_LEN, LMP_MAX_BYTES))
30148456Spjd#define PERFMON_DISP_NAME_LEN (PERFMON_DATA_LEN-sizeof(uint64_t))
31148456Spjd
32232502Seadlerstruct perfmon_overflow_data {
33148456Spjd    uint64_t ip; // Instruction pointer when overflow was fired
34232502Seadler    char name[PERFMON_DISP_NAME_LEN]; // Name of the running task
35148456Spjd};
36148456Spjd
37148456Spjd#endif //BARRELFISH_KPI_PERFMON_H
38148456Spjd
39148456Spjd