Deleted Added
sdiff udiff text old ( 11039:fe230bcf3f38 ) new ( 11049:dfb0aa3f0649 )
full compact
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}
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
155uint64_t
156CacheRecorder::aggregateRecords(uint8_t **buf, uint64_t total_size)
157{
158 std::sort(m_records.begin(), m_records.end(), compareTraceRecords);
159
160 int size = m_records.size();
161 uint64_t 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 ---