Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: src/a64/instrument-a64.cc

Issue 132233055: Consistenly use stderr for printing simulator and debug messages (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/a64/debugger-a64.h ('k') | src/a64/macro-assembler-a64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 {"Store FP", Gauge}, 111 {"Store FP", Gauge},
112 {"Store Pair", Gauge}, 112 {"Store Pair", Gauge},
113 113
114 {"PC Addressing", Gauge}, 114 {"PC Addressing", Gauge},
115 {"Other", Gauge}, 115 {"Other", Gauge},
116 {"SP Adjust", Gauge}, 116 {"SP Adjust", Gauge},
117 }; 117 };
118 118
119 119
120 Instrument::Instrument(const char* datafile, uint64_t sample_period) 120 Instrument::Instrument(const char* datafile, uint64_t sample_period)
121 : output_stream_(stdout), sample_period_(sample_period) { 121 : output_stream_(stderr), sample_period_(sample_period) {
122 122
123 // Set up the output stream. If datafile is non-NULL, use that file. If it 123 // Set up the output stream. If datafile is non-NULL, use that file. If it
124 // can't be opened, or datafile is NULL, use stdout. 124 // can't be opened, or datafile is NULL, use stderr.
125 if (datafile != NULL) { 125 if (datafile != NULL) {
126 output_stream_ = fopen(datafile, "w"); 126 output_stream_ = fopen(datafile, "w");
127 if (output_stream_ == NULL) { 127 if (output_stream_ == NULL) {
128 printf("Can't open output file %s. Using stdout.\n", datafile); 128 fprintf(stderr, "Can't open output file %s. Using stderr.\n", datafile);
129 output_stream_ = stdout; 129 output_stream_ = stderr;
130 } 130 }
131 } 131 }
132 132
133 static const int num_counters = 133 static const int num_counters =
134 sizeof(kCounterList) / sizeof(CounterDescriptor); 134 sizeof(kCounterList) / sizeof(CounterDescriptor);
135 135
136 // Dump an instrumentation description comment at the top of the file. 136 // Dump an instrumentation description comment at the top of the file.
137 fprintf(output_stream_, "# counters=%d\n", num_counters); 137 fprintf(output_stream_, "# counters=%d\n", num_counters);
138 fprintf(output_stream_, "# sample_period=%" PRIu64 "\n", sample_period_); 138 fprintf(output_stream_, "# sample_period=%" PRIu64 "\n", sample_period_);
139 139
(...skipping 10 matching lines...) Expand all
150 Instrument::~Instrument() { 150 Instrument::~Instrument() {
151 // Dump any remaining instruction data to the output file. 151 // Dump any remaining instruction data to the output file.
152 DumpCounters(); 152 DumpCounters();
153 153
154 // Free all the counter objects. 154 // Free all the counter objects.
155 std::list<Counter*>::iterator it; 155 std::list<Counter*>::iterator it;
156 for (it = counters_.begin(); it != counters_.end(); it++) { 156 for (it = counters_.begin(); it != counters_.end(); it++) {
157 delete *it; 157 delete *it;
158 } 158 }
159 159
160 if (output_stream_ != stdout) { 160 if (output_stream_ != stderr) {
161 fclose(output_stream_); 161 fclose(output_stream_);
162 } 162 }
163 } 163 }
164 164
165 165
166 void Instrument::Update() { 166 void Instrument::Update() {
167 // Increment the instruction counter, and dump all counters if a sample period 167 // Increment the instruction counter, and dump all counters if a sample period
168 // has elapsed. 168 // has elapsed.
169 static Counter* counter = GetCounter("Instruction"); 169 static Counter* counter = GetCounter("Instruction");
170 ASSERT(counter->type() == Cumulative); 170 ASSERT(counter->type() == Cumulative);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 610
611 void Instrument::VisitUnimplemented(Instruction* instr) { 611 void Instrument::VisitUnimplemented(Instruction* instr) {
612 Update(); 612 Update();
613 static Counter* counter = GetCounter("Other"); 613 static Counter* counter = GetCounter("Other");
614 counter->Increment(); 614 counter->Increment();
615 } 615 }
616 616
617 617
618 } } // namespace v8::internal 618 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/debugger-a64.h ('k') | src/a64/macro-assembler-a64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698