Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: components/leveldb_proto/leveldb_database.cc

Issue 2399903004: Add LevelDB database names to tracing path for easier debugging (Closed)
Patch Set: Add missing databases. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/trace_event/memory_infra_background_whitelist.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/leveldb_proto/leveldb_database.h" 5 #include "components/leveldb_proto/leveldb_database.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (!db_) 180 if (!db_)
181 return false; 181 return false;
182 182
183 std::string value; 183 std::string value;
184 uint64_t size; 184 uint64_t size;
185 bool res = db_->GetProperty("leveldb.approximate-memory-usage", &value); 185 bool res = db_->GetProperty("leveldb.approximate-memory-usage", &value);
186 DCHECK(res); 186 DCHECK(res);
187 res = base::StringToUint64(value, &size); 187 res = base::StringToUint64(value, &size);
188 DCHECK(res); 188 DCHECK(res);
189 189
190 std::string dump_name = "leveldb/leveldb_proto";
191 if (!client_name_.empty())
192 dump_name += "/" + client_name_;
190 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( 193 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(
191 base::StringPrintf("leveldb/leveldb_proto/0x%" PRIXPTR, 194 base::StringPrintf("%s/0x%" PRIXPTR, dump_name.c_str(),
192 reinterpret_cast<uintptr_t>(db_.get()))); 195 reinterpret_cast<uintptr_t>(db_.get())));
193 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 196 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
194 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size); 197 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size);
195 if (!client_name_.empty() &&
196 dump_args.level_of_detail !=
197 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
198 dump->AddString("client_name", "", client_name_);
199 }
200 198
201 // Memory is allocated from system allocator (malloc). 199 // Memory is allocated from system allocator (malloc).
202 const char* system_allocator_pool_name = 200 const char* system_allocator_pool_name =
203 base::trace_event::MemoryDumpManager::GetInstance() 201 base::trace_event::MemoryDumpManager::GetInstance()
204 ->system_allocator_pool_name(); 202 ->system_allocator_pool_name();
205 if (system_allocator_pool_name) 203 if (system_allocator_pool_name)
206 pmd->AddSuballocation(dump->guid(), system_allocator_pool_name); 204 pmd->AddSuballocation(dump->guid(), system_allocator_pool_name);
207 205
208 return true; 206 return true;
209 } 207 }
210 208
211 } // namespace leveldb_proto 209 } // namespace leveldb_proto
OLDNEW
« no previous file with comments | « base/trace_event/memory_infra_background_whitelist.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698