| 99 | void HXTRealloc(void* old_obj, void* new_obj, int new_Size); |
| 100 | |
| 101 | void Stash() |
| 102 | { |
| 103 | TelemetryFrame *stash = new TelemetryFrame(); |
| 104 | |
| 105 | IgnoreAllocs(1); |
| 106 | |
| 107 | stash->gctime = gcTimer*1000000; // usec |
| 108 | gcTimer = 0; |
| 109 | |
| 110 | stash->gcoverhead = gcOverhead*1000000; // usec |
| 111 | gcOverhead = 0; |
| 112 | |
| 113 | alloc_mutex.lock(); |
| 114 | |
| 115 | if (_last_obj!=0) lookup_last_object_type(); |
| 116 | |
| 117 | stash->allocation_data = allocation_data; |
| 118 | stash->samples = samples; |
| 119 | |
| 120 | samples = profiler_enabled ? new std::vector<int>() : 0; |
| 121 | if (allocations_enabled) { |
| 122 | allocation_data = new std::vector<int>(); |
| 123 | } |
| 124 | |
| 125 | alloc_mutex.unlock(); |
| 126 | |
| 127 | int i,size; |
| 128 | stash->names = 0; |
| 129 | if (profiler_enabled) { |
| 130 | stash->names = new std::vector<const char*>(); |
| 131 | size = names.size(); |
| 132 | for (i=namesStashed; i<size; i++) { |
| 133 | stash->names->push_back(names.at(i)); |
| 134 | } |
| 135 | //printf("Stash pushed %d names, %d\n", (size-namesStashed), stash->names->size()); |
| 136 | namesStashed = names.size(); |
| 137 | } |
| 138 | |
| 139 | stash->stacks = 0; |
| 140 | if (allocations_enabled) { |
| 141 | stash->stacks = new std::vector<int>(); |
| 142 | size = allocStacks.size(); |
| 143 | for (i=allocStacksStashed; i<size; i++) { |
| 144 | stash->stacks->push_back(allocStacks.at(i)); |
| 145 | } |
| 146 | allocStacksStashed = allocStacks.size(); |
| 147 | } |
| 148 | |
| 149 | { |
| 150 | std::lock_guard<std::recursive_mutex> lock(gStashMutex); |
| 151 | |
| 152 | stashed.push_back(*stash); |
| 153 | } |
| 154 | |
| 155 | IgnoreAllocs(-1); |
| 156 | } |
| 157 | |
| 158 | TelemetryFrame* Dump() |
no test coverage detected