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

Side by Side Diff: src/platform.h

Issue 21403: Added the simplest call stack sampling and call profile in tick processor output. (Closed)
Patch Set: Merged after Soren's changes to logging Created 11 years, 10 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 | « src/log.cc ('k') | src/platform-freebsd.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 // ---------------------------------------------------------------------------- 415 // ----------------------------------------------------------------------------
416 // Sampler 416 // Sampler
417 // 417 //
418 // A sampler periodically samples the state of the VM and optionally 418 // A sampler periodically samples the state of the VM and optionally
419 // (if used for profiling) the program counter and stack pointer for 419 // (if used for profiling) the program counter and stack pointer for
420 // the thread that created it. 420 // the thread that created it.
421 421
422 // TickSample captures the information collected for each sample. 422 // TickSample captures the information collected for each sample.
423 class TickSample { 423 class TickSample {
424 public: 424 public:
425 TickSample() : pc(0), sp(0), state(OTHER) {} 425 TickSample() : pc(0), sp(0), fp(0), state(OTHER) {}
426 unsigned int pc; // Instruction pointer. 426 unsigned int pc; // Instruction pointer.
427 unsigned int sp; // Stack pointer. 427 unsigned int sp; // Stack pointer.
428 unsigned int fp; // Frame pointer.
428 StateTag state; // The state of the VM. 429 StateTag state; // The state of the VM.
430 SmartPointer<Address> stack; // Call stack, null-terminated.
431
432 inline TickSample& operator=(const TickSample& rhs) {
433 if (this == &rhs) return *this;
434 pc = rhs.pc;
435 sp = rhs.sp;
436 fp = rhs.fp;
437 state = rhs.state;
438 DeleteArray(stack.Detach());
439 stack = rhs.stack;
440 return *this;
441 }
442
443 inline void InitStack(int depth) {
444 stack = SmartPointer<Address>(NewArray<Address>(depth + 1));
445 // null-terminate
446 stack[depth] = 0;
447 }
429 }; 448 };
430 449
431 class Sampler { 450 class Sampler {
432 public: 451 public:
433 // Initialize sampler. 452 // Initialize sampler.
434 explicit Sampler(int interval, bool profiling); 453 explicit Sampler(int interval, bool profiling);
435 virtual ~Sampler(); 454 virtual ~Sampler();
436 455
437 // This method is called for each sampling period with the current 456 // This method is called for each sampling period with the current
438 // program counter. 457 // program counter.
(...skipping 16 matching lines...) Expand all
455 bool active_; 474 bool active_;
456 PlatformData* data_; // Platform specific data. 475 PlatformData* data_; // Platform specific data.
457 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); 476 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
458 }; 477 };
459 478
460 #endif // ENABLE_LOGGING_AND_PROFILING 479 #endif // ENABLE_LOGGING_AND_PROFILING
461 480
462 } } // namespace v8::internal 481 } } // namespace v8::internal
463 482
464 #endif // V8_PLATFORM_H_ 483 #endif // V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698