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

Side by Side Diff: runtime/vm/profiler_service.h

Issue 2771293003: Resubmission of native memory allocation info surfacing in Observatory. Fixed crashing tests and st… (Closed)
Patch Set: Added page to Observatory to display native memory allocation information. Created 3 years, 8 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 | « runtime/vm/profiler.cc ('k') | runtime/vm/profiler_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_PROFILER_SERVICE_H_ 5 #ifndef RUNTIME_VM_PROFILER_SERVICE_H_
6 #define RUNTIME_VM_PROFILER_SERVICE_H_ 6 #define RUNTIME_VM_PROFILER_SERVICE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/code_observers.h" 9 #include "vm/code_observers.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 11 matching lines...) Expand all
22 // Forward declarations. 22 // Forward declarations.
23 class Code; 23 class Code;
24 class Function; 24 class Function;
25 class JSONArray; 25 class JSONArray;
26 class JSONStream; 26 class JSONStream;
27 class ProfileFunctionTable; 27 class ProfileFunctionTable;
28 class ProfileCodeTable; 28 class ProfileCodeTable;
29 class RawCode; 29 class RawCode;
30 class RawFunction; 30 class RawFunction;
31 class SampleFilter; 31 class SampleFilter;
32 class ProcessedSample;
32 class ProcessedSampleBuffer; 33 class ProcessedSampleBuffer;
33 34
34 class ProfileFunctionSourcePosition { 35 class ProfileFunctionSourcePosition {
35 public: 36 public:
36 explicit ProfileFunctionSourcePosition(TokenPosition token_pos); 37 explicit ProfileFunctionSourcePosition(TokenPosition token_pos);
37 38
38 void Tick(bool exclusive); 39 void Tick(bool exclusive);
39 40
40 TokenPosition token_pos() const { return token_pos_; } 41 TokenPosition token_pos() const { return token_pos_; }
41 intptr_t exclusive_ticks() const { return exclusive_ticks_; } 42 intptr_t exclusive_ticks() const { return exclusive_ticks_; }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 explicit ProfileTrieNode(intptr_t index); 251 explicit ProfileTrieNode(intptr_t index);
251 virtual ~ProfileTrieNode(); 252 virtual ~ProfileTrieNode();
252 253
253 virtual void PrintToJSONArray(JSONArray* array) const = 0; 254 virtual void PrintToJSONArray(JSONArray* array) const = 0;
254 255
255 // Index into function or code tables. 256 // Index into function or code tables.
256 intptr_t table_index() const { return table_index_; } 257 intptr_t table_index() const { return table_index_; }
257 258
258 intptr_t count() const { return count_; } 259 intptr_t count() const { return count_; }
259 260
260 void Tick() { count_++; } 261 void Tick(ProcessedSample* sample, bool exclusive = false);
262
263 void IncrementAllocation(intptr_t allocation, bool exclusive) {
264 ASSERT(allocation >= 0);
265 if (exclusive) {
266 exclusive_allocations_ += allocation;
267 }
268 inclusive_allocations_ += allocation;
269 }
270
271 intptr_t inclusive_allocations() const { return inclusive_allocations_; }
272 intptr_t exclusive_allocations() const { return exclusive_allocations_; }
261 273
262 intptr_t NumChildren() const { return children_.length(); } 274 intptr_t NumChildren() const { return children_.length(); }
263 275
264 ProfileTrieNode* At(intptr_t i) { return children_.At(i); } 276 ProfileTrieNode* At(intptr_t i) { return children_.At(i); }
265 277
266 intptr_t IndexOf(ProfileTrieNode* node); 278 intptr_t IndexOf(ProfileTrieNode* node);
267 279
268 intptr_t frame_id() const { return frame_id_; } 280 intptr_t frame_id() const { return frame_id_; }
269 void set_frame_id(intptr_t id) { 281 void set_frame_id(intptr_t id) {
270 ASSERT(frame_id_ == -1); 282 ASSERT(frame_id_ == -1);
271 frame_id_ = id; 283 frame_id_ = id;
272 } 284 }
273 285
274 protected: 286 protected:
275 void SortChildren(); 287 void SortChildren();
276 288
277 static int ProfileTrieNodeCompare(ProfileTrieNode* const* a, 289 static int ProfileTrieNodeCompare(ProfileTrieNode* const* a,
278 ProfileTrieNode* const* b) { 290 ProfileTrieNode* const* b) {
279 ASSERT(a != NULL); 291 ASSERT(a != NULL);
280 ASSERT(b != NULL); 292 ASSERT(b != NULL);
281 return (*b)->count() - (*a)->count(); 293 return (*b)->count() - (*a)->count();
282 } 294 }
283 295
284 296
285 intptr_t table_index_; 297 intptr_t table_index_;
286 intptr_t count_; 298 intptr_t count_;
299 intptr_t exclusive_allocations_;
300 intptr_t inclusive_allocations_;
287 ZoneGrowableArray<ProfileTrieNode*> children_; 301 ZoneGrowableArray<ProfileTrieNode*> children_;
288 intptr_t frame_id_; 302 intptr_t frame_id_;
289 303
290 friend class ProfileBuilder; 304 friend class ProfileBuilder;
291 }; 305 };
292 306
293 307
294 // The model for a profile. Most of the model is zone allocated, therefore 308 // The model for a profile. Most of the model is zone allocated, therefore
295 // a zone must be created that lives longer than this object. 309 // a zone must be created that lives longer than this object.
296 class Profile : public ValueObject { 310 class Profile : public ValueObject {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 ASSERT(profile_ != NULL); 385 ASSERT(profile_ != NULL);
372 } 386 }
373 387
374 void Reset(Profile::TrieKind trie_kind); 388 void Reset(Profile::TrieKind trie_kind);
375 389
376 const char* CurrentName(); 390 const char* CurrentName();
377 // Return the current node's peer's inclusive tick count. 391 // Return the current node's peer's inclusive tick count.
378 intptr_t CurrentInclusiveTicks(); 392 intptr_t CurrentInclusiveTicks();
379 // Return the current node's peer's exclusive tick count. 393 // Return the current node's peer's exclusive tick count.
380 intptr_t CurrentExclusiveTicks(); 394 intptr_t CurrentExclusiveTicks();
395 // Return the current node's inclusive allocation count.
396 intptr_t CurrentInclusiveAllocations();
397 // Return the current node's exclusive allocation count.
398 intptr_t CurrentExclusiveAllocations();
381 // Return the current node's tick count. 399 // Return the current node's tick count.
382 intptr_t CurrentNodeTickCount(); 400 intptr_t CurrentNodeTickCount();
383 // Return the number siblings (including yourself). 401 // Return the number siblings (including yourself).
384 intptr_t SiblingCount(); 402 intptr_t SiblingCount();
385 403
386 // If the following conditions are met returns the current token: 404 // If the following conditions are met returns the current token:
387 // 1) This is a function trie. 405 // 1) This is a function trie.
388 // 2) There is only one token position for a given function. 406 // 2) There is only one token position for a given function.
389 // Will return NULL otherwise. 407 // Will return NULL otherwise.
390 const char* CurrentToken(); 408 const char* CurrentToken();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 JSONStream* stream, 454 JSONStream* stream,
437 Profile::TagOrder tag_order, 455 Profile::TagOrder tag_order,
438 intptr_t extra_tags, 456 intptr_t extra_tags,
439 SampleFilter* filter, 457 SampleFilter* filter,
440 bool as_timline); 458 bool as_timline);
441 }; 459 };
442 460
443 } // namespace dart 461 } // namespace dart
444 462
445 #endif // RUNTIME_VM_PROFILER_SERVICE_H_ 463 #endif // RUNTIME_VM_PROFILER_SERVICE_H_
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/profiler_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698