Skip to content

Commit 1e4e4de

Browse files
authored
use traceEnabled on all trace types (#2698)
1 parent 0896edf commit 1e4e4de

1 file changed

Lines changed: 36 additions & 32 deletions

File tree

‎src/sst/elements/prospero/tracetool/sstmemtrace.cc‎

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,27 @@ VOID RecordMemRead(VOID * addr, UINT32 size, THREADID thr)
135135

136136
PerformInstrumentCountCheck(thr);
137137

138-
if(0 == trace_format) {
139-
fprintf(trace[thr], "%llu R %llu %d\n",
140-
(unsigned long long int) thread_instr_id[thr].insCount,
141-
(unsigned long long int) ma_addr,
142-
(int) size);
143-
thread_instr_id[thr].readCount++;
144-
} else if (1 == trace_format || 2 == trace_format) {
145-
copy(RECORD_BUFFER, &(thread_instr_id[thr].insCount), 0, sizeof(uint64_t) );
146-
copy(RECORD_BUFFER, &READ_OPERATION_CHAR, sizeof(uint64_t), sizeof(char) );
147-
copy(RECORD_BUFFER, &ma_addr, sizeof(uint64_t) + sizeof(char), sizeof(uint64_t) );
148-
copy(RECORD_BUFFER, &size, sizeof(uint64_t) + sizeof(char) + sizeof(uint64_t), sizeof(uint32_t) );
149-
150-
if(1 == trace_format) {
151-
if(thr < max_thread_count && (traceEnabled > 0)) {
152-
fwrite(RECORD_BUFFER, sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint32_t) + sizeof(char), 1, trace[thr]);
138+
if (traceEnabled > 0) {
139+
if(0 == trace_format) {
140+
fprintf(trace[thr], "%llu R %llu %d\n",
141+
(unsigned long long int) thread_instr_id[thr].insCount,
142+
(unsigned long long int) ma_addr,
143+
(int) size);
153144
thread_instr_id[thr].readCount++;
145+
} else if (1 == trace_format || 2 == trace_format) {
146+
copy(RECORD_BUFFER, &(thread_instr_id[thr].insCount), 0, sizeof(uint64_t) );
147+
copy(RECORD_BUFFER, &READ_OPERATION_CHAR, sizeof(uint64_t), sizeof(char) );
148+
copy(RECORD_BUFFER, &ma_addr, sizeof(uint64_t) + sizeof(char), sizeof(uint64_t) );
149+
copy(RECORD_BUFFER, &size, sizeof(uint64_t) + sizeof(char) + sizeof(uint64_t), sizeof(uint32_t) );
150+
151+
if(1 == trace_format) {
152+
if(thr < max_thread_count) {
153+
fwrite(RECORD_BUFFER, sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint32_t) + sizeof(char), 1, trace[thr]);
154+
thread_instr_id[thr].readCount++;
155+
}
156+
}
154157
}
155158
}
156-
}
157159

158160
#ifdef PROSPERO_DEBUG
159161
printf("PROSPERO: Completed into RecordMemRead...\n");
@@ -172,25 +174,27 @@ VOID RecordMemWrite(VOID * addr, UINT32 size, THREADID thr)
172174

173175
UINT64 ma_addr = (UINT64) addr;
174176

175-
if(0 == trace_format) {
176-
fprintf(trace[thr], "%llu W %llu %d\n",
177-
(unsigned long long int) thread_instr_id[thr].insCount,
178-
(unsigned long long int) ma_addr,
179-
(int) size);
180-
thread_instr_id[thr].writeCount++;
181-
} else if(1 == trace_format || 2 == trace_format) {
182-
copy(RECORD_BUFFER, &(thread_instr_id[thr].insCount), 0, sizeof(uint64_t) );
183-
copy(RECORD_BUFFER, &WRITE_OPERATION_CHAR, sizeof(uint64_t), sizeof(char) );
184-
copy(RECORD_BUFFER, &ma_addr, sizeof(uint64_t) + sizeof(char), sizeof(uint64_t) );
185-
copy(RECORD_BUFFER, &size, sizeof(uint64_t) + sizeof(char) + sizeof(uint64_t), sizeof(uint32_t) );
186-
187-
if(1 == trace_format) {
188-
if(thr < max_thread_count && (traceEnabled > 0)) {
189-
fwrite(RECORD_BUFFER, sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint32_t) + sizeof(char), 1, trace[thr]);
177+
if (traceEnabled > 0) {
178+
if(0 == trace_format) {
179+
fprintf(trace[thr], "%llu W %llu %d\n",
180+
(unsigned long long int) thread_instr_id[thr].insCount,
181+
(unsigned long long int) ma_addr,
182+
(int) size);
190183
thread_instr_id[thr].writeCount++;
184+
} else if(1 == trace_format || 2 == trace_format) {
185+
copy(RECORD_BUFFER, &(thread_instr_id[thr].insCount), 0, sizeof(uint64_t) );
186+
copy(RECORD_BUFFER, &WRITE_OPERATION_CHAR, sizeof(uint64_t), sizeof(char) );
187+
copy(RECORD_BUFFER, &ma_addr, sizeof(uint64_t) + sizeof(char), sizeof(uint64_t) );
188+
copy(RECORD_BUFFER, &size, sizeof(uint64_t) + sizeof(char) + sizeof(uint64_t), sizeof(uint32_t) );
189+
190+
if(1 == trace_format) {
191+
if(thr < max_thread_count) {
192+
fwrite(RECORD_BUFFER, sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint32_t) + sizeof(char), 1, trace[thr]);
193+
thread_instr_id[thr].writeCount++;
194+
}
195+
}
191196
}
192197
}
193-
}
194198
#ifdef PROSPERO_DEBUG
195199
printf("PROSPERO: Completed into RecordMemWrite...\n");
196200
#endif

0 commit comments

Comments
 (0)