~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/src/common/debugger/signaldata/PackedSignal.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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 */
 
15
 
 
16
#include <signaldata/PackedSignal.hpp>
 
17
#include <signaldata/LqhKey.hpp>
 
18
#include <debugger/DebuggerNames.hpp>
 
19
 
 
20
bool
 
21
printPACKED_SIGNAL(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
 
22
  fprintf(output, "Signal data: ");
 
23
  Uint32 i = 0;
 
24
  while (i < len)
 
25
    fprintf(output, "H\'%.8x ", theData[i++]);
 
26
  fprintf(output,"\n");
 
27
  fprintf(output, "--------- Begin Packed Signals --------\n");  
 
28
  // Print each signal separately
 
29
  for (i = 0; i < len;) {
 
30
    switch (PackedSignal::getSignalType(theData[i])) {
 
31
    case ZCOMMIT: {
 
32
      Uint32 signalLength = 4;
 
33
      fprintf(output, "--------------- Signal ----------------\n");
 
34
      fprintf(output, "r.bn: %u \"%s\", length: %u \"COMMIT\"\n", 
 
35
              receiverBlockNo, getBlockName(receiverBlockNo,""), signalLength);
 
36
      fprintf(output, "Signal data: ");
 
37
      for(Uint32 j = 0; j < signalLength; j++)
 
38
        fprintf(output, "H\'%.8x ", theData[i++]);
 
39
      fprintf(output,"\n");
 
40
      break;
 
41
    }
 
42
    case ZCOMPLETE: {
 
43
      Uint32 signalLength = 3;
 
44
      fprintf(output, "--------------- Signal ----------------\n");
 
45
      fprintf(output, "r.bn: %u \"%s\", length: %u \"COMPLETE\"\n",
 
46
              receiverBlockNo, getBlockName(receiverBlockNo,""), signalLength);
 
47
      fprintf(output, "Signal data: ");
 
48
      for(Uint32 j = 0; j < signalLength; j++)
 
49
        fprintf(output, "H\'%.8x ", theData[i++]);
 
50
      fprintf(output,"\n");
 
51
      break;
 
52
    }    
 
53
    case ZCOMMITTED: {
 
54
      Uint32 signalLength = 3;
 
55
      fprintf(output, "--------------- Signal ----------------\n");
 
56
      fprintf(output, "r.bn: %u \"%s\", length: %u \"COMMITTED\"\n",
 
57
              receiverBlockNo, getBlockName(receiverBlockNo,""), signalLength);
 
58
      fprintf(output, "Signal data: ");
 
59
      for(Uint32 j = 0; j < signalLength; j++)
 
60
        fprintf(output, "H\'%.8x ", theData[i++]);
 
61
      fprintf(output,"\n");
 
62
      break;
 
63
    }
 
64
    case ZCOMPLETED: {
 
65
      Uint32 signalLength = 3;
 
66
      fprintf(output, "--------------- Signal ----------------\n");
 
67
      fprintf(output, "r.bn: %u \"%s\", length: %u \"COMPLETED\"\n",
 
68
              receiverBlockNo, getBlockName(receiverBlockNo,""), signalLength);
 
69
      fprintf(output, "Signal data: ");
 
70
      for(Uint32 j = 0; j < signalLength; j++)
 
71
        fprintf(output, "H\'%.8x ", theData[i++]);
 
72
      fprintf(output,"\n");
 
73
      break;
 
74
    }
 
75
    case  ZLQHKEYCONF: {
 
76
      Uint32 signalLength = LqhKeyConf::SignalLength;
 
77
 
 
78
      fprintf(output, "--------------- Signal ----------------\n");
 
79
      fprintf(output, "r.bn: %u \"%s\", length: %u \"LQHKEYCONF\"\n",
 
80
              receiverBlockNo, getBlockName(receiverBlockNo,""), signalLength);
 
81
      printLQHKEYCONF(output, theData + i, signalLength, receiverBlockNo);
 
82
      i += signalLength;
 
83
      break;
 
84
    }
 
85
    case ZREMOVE_MARKER: {
 
86
      Uint32 signalLength = 2;
 
87
      fprintf(output, "--------------- Signal ----------------\n");
 
88
      fprintf(output, "r.bn: %u \"%s\", length: %u \"REMOVE_MARKER\"\n",
 
89
              receiverBlockNo, getBlockName(receiverBlockNo,""), signalLength);
 
90
      fprintf(output, "Signal data: ");
 
91
      i++; // Skip first word!
 
92
      for(Uint32 j = 0; j < signalLength; j++)
 
93
        fprintf(output, "H\'%.8x ", theData[i++]);
 
94
      fprintf(output,"\n");
 
95
      break;
 
96
    }
 
97
    default:
 
98
      fprintf(output, "Unknown signal type\n");
 
99
      i = len; // terminate printing
 
100
      break;
 
101
    }
 
102
  }//for
 
103
  fprintf(output, "--------- End Packed Signals ----------\n");
 
104
  return true;
 
105
}