1
/* Copyright (C) 2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16
//****************************************************************************
19
// SignalLoggerManager - Handle signal loggers
21
//****************************************************************************
22
#ifndef SignalLoggerManager_H
23
#define SignalLoggerManager_H
26
#include <kernel_types.h>
27
#include <BlockNumbers.h>
28
#include <TransporterDefinitions.hpp>
30
class SignalLoggerManager
33
SignalLoggerManager();
34
virtual ~SignalLoggerManager();
38
* @Returns old output stream
40
FILE * setOutputStream(FILE * output);
45
FILE * getOutputStream() const;
47
void flushSignalLog();
51
* @See also SimulatedBlock EXECUTE_DIRECT
53
void executeDirect(const SignalHeader&,
54
Uint8 prio, const Uint32 * theData, Uint32 node);
59
void executeSignal(const SignalHeader&, Uint8 prio,
60
const Uint32 * theData, Uint32 node,
61
const SegmentedSectionPtr ptr[3], Uint32 secs);
63
void executeSignal(const SignalHeader&, Uint8 prio,
64
const Uint32 * theData, Uint32 node,
65
const LinearSectionPtr ptr[3], Uint32 secs);
70
void sendSignal(const SignalHeader&, Uint8 prio,
71
const Uint32 * theData, Uint32 node,
72
const SegmentedSectionPtr ptr[3], Uint32 secs);
74
void sendSignal(const SignalHeader&, Uint8 prio,
75
const Uint32 * theData, Uint32 node,
76
const LinearSectionPtr ptr[3], Uint32 secs);
81
void sendSignalWithDelay(Uint32 delayInMilliSeconds,
83
Uint8 prio, const Uint32 * data, Uint32 node,
84
const SegmentedSectionPtr ptr[3], Uint32 secs);
87
* Generic messages in the signal log
89
void log(BlockNumber bno, const char * msg, ...);
102
* Returns no of loggers affected
104
int log(LogMode logMode, const char * params);
105
int logOn(bool allBlocks, BlockNumber bno, LogMode logMode);
106
int logOff(bool allBlocks, BlockNumber bno, LogMode logMode);
107
int logToggle(bool allBlocks, BlockNumber bno, LogMode logMode);
109
void setTrace(unsigned long trace);
110
unsigned long getTrace() const;
112
void setOwnNodeId(int nodeId);
113
void setLogDistributed(bool val);
118
static void printSignalHeader(FILE * output,
119
const SignalHeader & sh,
122
bool printReceiversSignalId);
125
* Function for printing the Signal Data
127
static void printSignalData(FILE * out,
128
const SignalHeader & sh, const Uint32 *);
131
* Print linear section.
133
static void printLinearSection(FILE * output,
134
const SignalHeader & sh,
135
const LinearSectionPtr ptr[3],
139
* Print segmented section.
141
static void printSegmentedSection(FILE * output,
142
const SignalHeader & sh,
143
const SegmentedSectionPtr ptr[3],
147
* Print data word in hex. Adds line break before the word
148
* when pos > 0 && pos % 7 == 0. Increments pos.
150
static void printDataWord(FILE * output, Uint32 & pos, const Uint32 data);
153
bool m_logDistributed;
157
int log(int cmd, BlockNumber bno, LogMode logMode);
160
Uint8 logModes[NO_OF_BLOCKS];
163
logMatch(BlockNumber bno, LogMode mask)
165
// avoid addressing outside logModes
167
bno < MIN_BLOCK_NO || bno > MAX_BLOCK_NO ||
168
(logModes[bno-MIN_BLOCK_NO] & mask);
172
#endif // SignalLoggerManager_H