2
* Copyright © 2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Alan Griffiths <alan@octopull.co.uk>
19
#ifndef MIR_REPORT_LOGGING_MESSAGE_PROCESSOR_REPORT_H_
20
#define MIR_REPORT_LOGGING_MESSAGE_PROCESSOR_REPORT_H_
22
#include "mir/frontend/message_processor_report.h"
23
#include "mir/time/clock.h"
27
#include <unordered_map>
41
struct InvocationDetails
43
time::Timestamp start;
45
std::string exception;
48
typedef std::unordered_map<int, InvocationDetails> Invocations;
50
struct MediatorDetails
52
Invocations current_invocations;
55
typedef std::unordered_map<void const*, MediatorDetails> Mediators;
58
class MessageProcessorReport : public mir::frontend::MessageProcessorReport
61
MessageProcessorReport(
62
std::shared_ptr<mir::logging::Logger> const& log,
63
std::shared_ptr<time::Clock> const& clock);
65
void received_invocation(void const* mediator, int id, std::string const& method);
67
void completed_invocation(void const* mediator, int id, bool result);
69
void unknown_method(void const* mediator, int id, std::string const& method);
71
void exception_handled(void const* mediator, int id, std::exception const& error);
73
void exception_handled(void const* mediator, std::exception const& error);
75
void sent_event(void const* mediator, MirSurfaceEvent const& event);
77
~MessageProcessorReport() noexcept(true);
80
std::shared_ptr<mir::logging::Logger> const log;
81
std::shared_ptr<time::Clock> const clock;
83
detail::Mediators mediators;
89
#endif /* MIR_REPORT_LOGGING_MESSAGE_PROCESSOR_REPORT_H_ */