140 }
141 _file_count++;
142 } else {
143 _stream = new (ResourceObj::C_HEAP, mtCompiler) networkStream();
144
145 // Try to connect to visualizer
146 if (_stream->connect(PrintIdealGraphAddress, PrintIdealGraphPort)) {
147 char c = 0;
148 _stream->read(&c, 1);
149 if (c != 'y') {
150 tty->print_cr("Client available, but does not want to receive data!");
151 _stream->close();
152 delete _stream;
153 _stream = NULL;
154 return;
155 }
156 _output = _stream;
157 } else {
158 // It would be nice if we could shut down cleanly but it should
159 // be an error if we can't connect to the visualizer.
160 fatal(err_msg_res("Couldn't connect to visualizer at %s:" INTX_FORMAT,
161 PrintIdealGraphAddress, PrintIdealGraphPort));
162 }
163 }
164
165 _xml = new (ResourceObj::C_HEAP, mtCompiler) xmlStream(_output);
166
167 head(TOP_ELEMENT);
168 }
169
170 // Destructor, close file or network stream
171 IdealGraphPrinter::~IdealGraphPrinter() {
172
173 tail(TOP_ELEMENT);
174
175 // tty->print_cr("Walk time: %d", (int)_walk_time.milliseconds());
176 // tty->print_cr("Output time: %d", (int)_output_time.milliseconds());
177 // tty->print_cr("Build blocks time: %d", (int)_build_blocks_time.milliseconds());
178
179 if(_xml) {
180 delete _xml;
181 _xml = NULL;
|
140 }
141 _file_count++;
142 } else {
143 _stream = new (ResourceObj::C_HEAP, mtCompiler) networkStream();
144
145 // Try to connect to visualizer
146 if (_stream->connect(PrintIdealGraphAddress, PrintIdealGraphPort)) {
147 char c = 0;
148 _stream->read(&c, 1);
149 if (c != 'y') {
150 tty->print_cr("Client available, but does not want to receive data!");
151 _stream->close();
152 delete _stream;
153 _stream = NULL;
154 return;
155 }
156 _output = _stream;
157 } else {
158 // It would be nice if we could shut down cleanly but it should
159 // be an error if we can't connect to the visualizer.
160 fatal("Couldn't connect to visualizer at %s:" INTX_FORMAT,
161 PrintIdealGraphAddress, PrintIdealGraphPort);
162 }
163 }
164
165 _xml = new (ResourceObj::C_HEAP, mtCompiler) xmlStream(_output);
166
167 head(TOP_ELEMENT);
168 }
169
170 // Destructor, close file or network stream
171 IdealGraphPrinter::~IdealGraphPrinter() {
172
173 tail(TOP_ELEMENT);
174
175 // tty->print_cr("Walk time: %d", (int)_walk_time.milliseconds());
176 // tty->print_cr("Output time: %d", (int)_output_time.milliseconds());
177 // tty->print_cr("Build blocks time: %d", (int)_build_blocks_time.milliseconds());
178
179 if(_xml) {
180 delete _xml;
181 _xml = NULL;
|