mariadb/storage/ndb/include/debugger/SignalLoggerManager.hpp
unknown 463c82e24b Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-clean


BitKeeper/etc/logging_ok:
  auto-union
mysql-test/mysql-test-run.sh:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
storage/ndb/include/debugger/SignalLoggerManager.hpp:
  Auto merged
storage/ndb/include/kernel/ndb_limits.h:
  Auto merged
storage/ndb/include/kernel/signaldata/AccScan.hpp:
  Auto merged
storage/ndb/include/kernel/signaldata/NextScan.hpp:
  Auto merged
storage/ndb/include/kernel/signaldata/ScanFrag.hpp:
  Auto merged
storage/ndb/include/kernel/signaldata/ScanTab.hpp:
  Auto merged
storage/ndb/include/kernel/signaldata/TcCommit.hpp:
  Auto merged
storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp:
  Auto merged
storage/ndb/include/ndbapi/NdbScanOperation.hpp:
  Auto merged
storage/ndb/include/ndbapi/NdbTransaction.hpp:
  Auto merged
storage/ndb/src/common/debugger/SignalLoggerManager.cpp:
  Auto merged
storage/ndb/src/common/debugger/signaldata/ScanTab.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/SchemaFile.hpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp:
  Auto merged
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/Makefile.am:
  Auto merged
storage/ndb/src/kernel/vm/Makefile.am:
  Auto merged
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbTransaction.cpp:
  Auto merged
storage/ndb/test/include/HugoTransactions.hpp:
  Auto merged
storage/ndb/test/ndbapi/testDict.cpp:
  Auto merged
storage/ndb/test/ndbapi/testNodeRestart.cpp:
  Auto merged
storage/ndb/test/ndbapi/testOIBasic.cpp:
  Auto merged
storage/ndb/test/ndbapi/testScan.cpp:
  Auto merged
storage/ndb/test/ndbapi/testScanPerf.cpp:
  Auto merged
storage/ndb/test/run-test/daily-devel-tests.txt:
  Auto merged
storage/ndb/test/src/HugoOperations.cpp:
  Auto merged
storage/ndb/test/src/HugoTransactions.cpp:
  Auto merged
2005-05-02 13:19:50 +02:00

174 lines
4.7 KiB
C++

/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
//****************************************************************************
//
// .NAME
// SignalLoggerManager - Handle signal loggers
//
//****************************************************************************
#ifndef SignalLoggerManager_H
#define SignalLoggerManager_H
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <TransporterDefinitions.hpp>
class SignalLoggerManager
{
public:
SignalLoggerManager();
virtual ~SignalLoggerManager();
/**
* Sets output
* @Returns old output stream
*/
FILE * setOutputStream(FILE * output);
/**
* Gets current output
*/
FILE * getOutputStream() const;
void flushSignalLog();
/**
* For direct signals
* @See also SimulatedBlock EXECUTE_DIRECT
*/
void executeDirect(const SignalHeader&,
Uint8 prio, const Uint32 * theData, Uint32 node);
/**
* For input signals
*/
void executeSignal(const SignalHeader&, Uint8 prio,
const Uint32 * theData, Uint32 node,
const SegmentedSectionPtr ptr[3], Uint32 secs);
void executeSignal(const SignalHeader&, Uint8 prio,
const Uint32 * theData, Uint32 node,
const LinearSectionPtr ptr[3], Uint32 secs);
/**
* For output signals
*/
void sendSignal(const SignalHeader&, Uint8 prio,
const Uint32 * theData, Uint32 node,
const SegmentedSectionPtr ptr[3], Uint32 secs);
void sendSignal(const SignalHeader&, Uint8 prio,
const Uint32 * theData, Uint32 node,
const LinearSectionPtr ptr[3], Uint32 secs);
/**
* For output signals
*/
void sendSignalWithDelay(Uint32 delayInMilliSeconds,
const SignalHeader&,
Uint8 prio, const Uint32 * data, Uint32 node,
const SegmentedSectionPtr ptr[3], Uint32 secs);
/**
* Generic messages in the signal log
*/
void log(BlockNumber bno, const char * msg, ...);
/**
* LogModes
*/
enum LogMode {
LogOff = 0,
LogIn = 1,
LogOut = 2,
LogInOut = 3
};
/**
* Returns no of loggers affected
*/
int log(LogMode logMode, const char * params);
int logOn(bool allBlocks, BlockNumber bno, LogMode logMode);
int logOff(bool allBlocks, BlockNumber bno, LogMode logMode);
int logToggle(bool allBlocks, BlockNumber bno, LogMode logMode);
void setTrace(unsigned long trace);
unsigned long getTrace() const;
void setOwnNodeId(int nodeId);
void setLogDistributed(bool val);
/**
* Print header
*/
static void printSignalHeader(FILE * output,
const SignalHeader & sh,
Uint8 prio,
Uint32 node,
bool printReceiversSignalId);
/**
* Function for printing the Signal Data
*/
static void printSignalData(FILE * out,
const SignalHeader & sh, const Uint32 *);
/**
* Print linear section.
*/
static void printLinearSection(FILE * output,
const SignalHeader & sh,
const LinearSectionPtr ptr[3],
unsigned i);
/**
* Print segmented section.
*/
static void printSegmentedSection(FILE * output,
const SignalHeader & sh,
const SegmentedSectionPtr ptr[3],
unsigned i);
/**
* Print data word in hex. Adds line break before the word
* when pos > 0 && pos % 7 == 0. Increments pos.
*/
static void printDataWord(FILE * output, Uint32 & pos, const Uint32 data);
private:
bool m_logDistributed;
Uint32 m_ownNodeId;
FILE * outputStream;
int log(int cmd, BlockNumber bno, LogMode logMode);
Uint32 traceId;
Uint8 logModes[NO_OF_BLOCKS];
inline bool
logMatch(BlockNumber bno, LogMode mask)
{
// avoid addressing outside logModes
return
bno < MIN_BLOCK_NO || bno > MAX_BLOCK_NO ||
(logModes[bno-MIN_BLOCK_NO] & mask);
}
};
#endif // SignalLoggerManager_H