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

Side by Side Diff: chrome/browser/task_profiler/task_profiler_data_serializer.cc

Issue 2881493004: Marshal 64 bit byte counts as double to the profiler. (Closed)
Patch Set: Fix the serialization unit test. Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/task_profiler/task_profiler_data_serializer.h" 5 #include "chrome/browser/task_profiler/task_profiler_data_serializer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 dictionary->SetInteger("count", death_data.count); 61 dictionary->SetInteger("count", death_data.count);
62 dictionary->SetInteger("run_ms", death_data.run_duration_sum); 62 dictionary->SetInteger("run_ms", death_data.run_duration_sum);
63 dictionary->SetInteger("run_ms_max", death_data.run_duration_max); 63 dictionary->SetInteger("run_ms_max", death_data.run_duration_max);
64 dictionary->SetInteger("run_ms_sample", death_data.run_duration_sample); 64 dictionary->SetInteger("run_ms_sample", death_data.run_duration_sample);
65 dictionary->SetInteger("queue_ms", death_data.queue_duration_sum); 65 dictionary->SetInteger("queue_ms", death_data.queue_duration_sum);
66 dictionary->SetInteger("queue_ms_max", death_data.queue_duration_max); 66 dictionary->SetInteger("queue_ms_max", death_data.queue_duration_max);
67 dictionary->SetInteger("queue_ms_sample", death_data.queue_duration_sample); 67 dictionary->SetInteger("queue_ms_sample", death_data.queue_duration_sample);
68 68
69 dictionary->SetInteger("alloc_ops", death_data.alloc_ops); 69 dictionary->SetInteger("alloc_ops", death_data.alloc_ops);
70 dictionary->SetInteger("free_ops", death_data.free_ops); 70 dictionary->SetInteger("free_ops", death_data.free_ops);
71 dictionary->SetInteger("allocated_bytes", death_data.allocated_bytes); 71 // The byte counts are 64 bit integers, pass them through as doubles, as
72 dictionary->SetInteger("freed_bytes", death_data.freed_bytes); 72 // integer values truncate to 32 bits.
73 dictionary->SetInteger("alloc_overhead_bytes", 73 dictionary->SetDouble("allocated_bytes", death_data.allocated_bytes);
74 death_data.alloc_overhead_bytes); 74 dictionary->SetDouble("freed_bytes", death_data.freed_bytes);
75 dictionary->SetDouble("alloc_overhead_bytes",
76 death_data.alloc_overhead_bytes);
75 dictionary->SetInteger("max_allocated_bytes", death_data.max_allocated_bytes); 77 dictionary->SetInteger("max_allocated_bytes", death_data.max_allocated_bytes);
76 } 78 }
77 79
78 // Re-serializes the |snapshot| into |dictionary|. 80 // Re-serializes the |snapshot| into |dictionary|.
79 void TaskSnapshotToValue(const TaskSnapshot& snapshot, 81 void TaskSnapshotToValue(const TaskSnapshot& snapshot,
80 base::DictionaryValue* dictionary) { 82 base::DictionaryValue* dictionary) {
81 BirthOnThreadSnapshotToValue(snapshot.birth, "birth", dictionary); 83 BirthOnThreadSnapshotToValue(snapshot.birth, "birth", dictionary);
82 84
83 std::unique_ptr<base::DictionaryValue> death_data(new base::DictionaryValue); 85 std::unique_ptr<base::DictionaryValue> death_data(new base::DictionaryValue);
84 DeathDataSnapshotToValue(snapshot.death_data, death_data.get()); 86 DeathDataSnapshotToValue(snapshot.death_data, death_data.get());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 tasks_list->Append(std::move(snapshot)); 141 tasks_list->Append(std::move(snapshot));
140 } 142 }
141 dictionary->Set("list", tasks_list.release()); 143 dictionary->Set("list", tasks_list.release());
142 144
143 dictionary->SetInteger("process_id", process_id); 145 dictionary->SetInteger("process_id", process_id);
144 dictionary->SetString("process_type", content::GetProcessTypeNameInEnglish( 146 dictionary->SetString("process_type", content::GetProcessTypeNameInEnglish(
145 AsChromeProcessType(process_type))); 147 AsChromeProcessType(process_type)));
146 } 148 }
147 149
148 } // namespace task_profiler 150 } // namespace task_profiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698