CacheRecorder.cc (11049:dfb0aa3f0649) | CacheRecorder.cc (11061:25b53a7195f7) |
---|---|
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 --- 147 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 | 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 --- 147 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 |
164uint64 165CacheRecorder::aggregateRecords(uint8_t** buf, uint64 total_size) | 164uint64_t 165CacheRecorder::aggregateRecords(uint8_t **buf, uint64_t total_size) |
166{ 167 std::sort(m_records.begin(), m_records.end(), compareTraceRecords); 168 169 int size = m_records.size(); | 166{ 167 std::sort(m_records.begin(), m_records.end(), compareTraceRecords); 168 169 int size = m_records.size(); |
170 uint64 current_size = 0; | 170 uint64_t current_size = 0; |
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 --- | 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 --- |