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

Side by Side Diff: net/tools/dump_cache/dump_files.cc

Issue 12880: Disk cache: Add support for an extra data stream for each cache entry.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 // Performs basic inspection of the disk cache files with minimal disruption 5 // Performs basic inspection of the disk cache files with minimal disruption
6 // to the actual files (they still may change if an error is detected on the 6 // to the actual files (they still may change if an error is detected on the
7 // files). 7 // files).
8 8
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string> 10 #include <string>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return; 54 return;
55 55
56 printf("Index file:\n"); 56 printf("Index file:\n");
57 printf("magic: %x\n", header.magic); 57 printf("magic: %x\n", header.magic);
58 printf("version: %d.%d\n", header.version >> 16, header.version & 0xffff); 58 printf("version: %d.%d\n", header.version >> 16, header.version & 0xffff);
59 printf("entries: %d\n", header.num_entries); 59 printf("entries: %d\n", header.num_entries);
60 printf("total bytes: %d\n", header.num_bytes); 60 printf("total bytes: %d\n", header.num_bytes);
61 printf("last file number: %d\n", header.last_file); 61 printf("last file number: %d\n", header.last_file);
62 printf("current id: %d\n", header.this_id); 62 printf("current id: %d\n", header.this_id);
63 printf("table length: %d\n", header.table_len); 63 printf("table length: %d\n", header.table_len);
64 for (int i = 0; i < 5; i++) {
65 printf("head %d: 0x%x\n", i, header.lru.heads[i]);
66 printf("tail %d: 0x%x\n", i, header.lru.tails[i]);
67 }
68 printf("transaction: 0x%x\n", header.lru.transaction);
69 printf("operation: %d\n", header.lru.operation);
70 printf("operation list: %d\n", header.lru.operation_list);
64 printf("-------------------------\n\n"); 71 printf("-------------------------\n\n");
65 } 72 }
66 73
67 // Dumps the contents of a block-file header. 74 // Dumps the contents of a block-file header.
68 void DumpBlockHeader(const std::wstring name) { 75 void DumpBlockHeader(const std::wstring name) {
69 disk_cache::BlockFileHeader header; 76 disk_cache::BlockFileHeader header;
70 if (!ReadHeader(name, reinterpret_cast<char*>(&header), sizeof(header))) 77 if (!ReadHeader(name, reinterpret_cast<char*>(&header), sizeof(header)))
71 return; 78 return;
72 79
73 std::wstring file_name = file_util::GetFilenameFromPath(name); 80 std::wstring file_name = file_util::GetFilenameFromPath(name);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (key.size() > 50) 218 if (key.size() > 50)
212 key.resize(50); 219 key.resize(50);
213 } 220 }
214 221
215 printf("hash: 0x%x\n", entry.hash); 222 printf("hash: 0x%x\n", entry.hash);
216 printf("next entry: 0x%x\n", entry.next); 223 printf("next entry: 0x%x\n", entry.next);
217 printf("rankings: 0x%x\n", entry.rankings_node); 224 printf("rankings: 0x%x\n", entry.rankings_node);
218 printf("key length: %d\n", entry.key_len); 225 printf("key length: %d\n", entry.key_len);
219 printf("key: \"%s\"\n", key.c_str()); 226 printf("key: \"%s\"\n", key.c_str());
220 printf("key addr: 0x%x\n", entry.long_key); 227 printf("key addr: 0x%x\n", entry.long_key);
221 printf("data size 0: %d\n", entry.data_size[0]); 228 printf("reuse count: %d\n", entry.reuse_count);
222 printf("data size 1: %d\n", entry.data_size[1]); 229 printf("refetch count: %d\n", entry.refetch_count);
223 printf("data addr 0: 0x%x\n", entry.data_addr[0]); 230 printf("state: %d\n", entry.state);
224 printf("data addr 1: 0x%x\n", entry.data_addr[1]); 231 for (int i = 0; i < 4; i++) {
232 printf("data size %d: %d\n", i, entry.data_size[i]);
233 printf("data addr %d: 0x%x\n", i, entry.data_addr[i]);
234 }
225 printf("----------\n\n"); 235 printf("----------\n\n");
226 } 236 }
227 237
228 void DumpRankings(const disk_cache::RankingsNode& rankings) { 238 void DumpRankings(const disk_cache::RankingsNode& rankings) {
229 printf("next: 0x%x\n", rankings.next); 239 printf("next: 0x%x\n", rankings.next);
230 printf("prev: 0x%x\n", rankings.prev); 240 printf("prev: 0x%x\n", rankings.prev);
231 printf("entry: 0x%x\n", rankings.contents); 241 printf("entry: 0x%x\n", rankings.contents);
232 printf("dirty: %d\n", rankings.dirty); 242 printf("dirty: %d\n", rankings.dirty);
233 printf("pointer: 0x%x\n", rankings.pointer); 243 printf("pointer: 0x%x\n", rankings.pointer);
234 printf("----------\n\n"); 244 printf("----------\n\n");
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 DumpEntry(entry); 301 DumpEntry(entry);
292 disk_cache::RankingsNode rankings; 302 disk_cache::RankingsNode rankings;
293 if (dumper.LoadRankings(entry.rankings_node, &rankings)) 303 if (dumper.LoadRankings(entry.rankings_node, &rankings))
294 DumpRankings(rankings); 304 DumpRankings(rankings);
295 } 305 }
296 306
297 printf("Done.\n"); 307 printf("Done.\n");
298 308
299 return 0; 309 return 0;
300 } 310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698