CacheRecorder.cc (11039:fe230bcf3f38) | CacheRecorder.cc (11049:dfb0aa3f0649) |
---|---|
1/* 2 * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood 3 * Copyright (c) 2010 Advanced Micro Devices, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 44 unchanged lines hidden (view full) --- 53 uint64_t uncompressed_trace_size, 54 std::vector<Sequencer*>& seq_map, 55 uint64_t block_size_bytes) 56 : m_uncompressed_trace(uncompressed_trace), 57 m_uncompressed_trace_size(uncompressed_trace_size), 58 m_seq_map(seq_map), m_bytes_read(0), m_records_read(0), 59 m_records_flushed(0), m_block_size_bytes(block_size_bytes) 60{ | 1/* 2 * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood 3 * Copyright (c) 2010 Advanced Micro Devices, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 44 unchanged lines hidden (view full) --- 53 uint64_t uncompressed_trace_size, 54 std::vector<Sequencer*>& seq_map, 55 uint64_t block_size_bytes) 56 : m_uncompressed_trace(uncompressed_trace), 57 m_uncompressed_trace_size(uncompressed_trace_size), 58 m_seq_map(seq_map), m_bytes_read(0), m_records_read(0), 59 m_records_flushed(0), m_block_size_bytes(block_size_bytes) 60{ |
61 if (m_uncompressed_trace != NULL) { 62 if (m_block_size_bytes < RubySystem::getBlockSizeBytes()) { 63 // Block sizes larger than when the trace was recorded are not 64 // supported, as we cannot reliably turn accesses to smaller blocks 65 // into larger ones. 66 panic("Recorded cache block size (%d) < current block size (%d) !!", 67 m_block_size_bytes, RubySystem::getBlockSizeBytes()); 68 } 69 } |
|
61} 62 63CacheRecorder::~CacheRecorder() 64{ 65 if (m_uncompressed_trace != NULL) { 66 delete [] m_uncompressed_trace; 67 m_uncompressed_trace = NULL; 68 } --- 78 unchanged lines hidden (view full) --- 147 rec->m_pc_address = pc_addr; 148 rec->m_type = type; 149 memcpy(rec->m_data, data.getData(0, m_block_size_bytes), 150 m_block_size_bytes); 151 152 m_records.push_back(rec); 153} 154 | 70} 71 72CacheRecorder::~CacheRecorder() 73{ 74 if (m_uncompressed_trace != NULL) { 75 delete [] m_uncompressed_trace; 76 m_uncompressed_trace = NULL; 77 } --- 78 unchanged lines hidden (view full) --- 156 rec->m_pc_address = pc_addr; 157 rec->m_type = type; 158 memcpy(rec->m_data, data.getData(0, m_block_size_bytes), 159 m_block_size_bytes); 160 161 m_records.push_back(rec); 162} 163 |
155uint64_t 156CacheRecorder::aggregateRecords(uint8_t **buf, uint64_t total_size) | 164uint64 165CacheRecorder::aggregateRecords(uint8_t** buf, uint64 total_size) |
157{ 158 std::sort(m_records.begin(), m_records.end(), compareTraceRecords); 159 160 int size = m_records.size(); | 166{ 167 std::sort(m_records.begin(), m_records.end(), compareTraceRecords); 168 169 int size = m_records.size(); |
161 uint64_t current_size = 0; | 170 uint64 current_size = 0; |
162 int record_size = sizeof(TraceRecord) + m_block_size_bytes; 163 164 for (int i = 0; i < size; ++i) { 165 // Determine if we need to expand the buffer size 166 if (current_size + record_size > total_size) { 167 uint8_t* new_buf = new (nothrow) uint8_t[total_size * 2]; 168 if (new_buf == NULL) { 169 fatal("Unable to allocate buffer of size %s\n", --- 20 unchanged lines hidden --- | 171 int record_size = sizeof(TraceRecord) + m_block_size_bytes; 172 173 for (int i = 0; i < size; ++i) { 174 // Determine if we need to expand the buffer size 175 if (current_size + record_size > total_size) { 176 uint8_t* new_buf = new (nothrow) uint8_t[total_size * 2]; 177 if (new_buf == NULL) { 178 fatal("Unable to allocate buffer of size %s\n", --- 20 unchanged lines hidden --- |