OLD | NEW |
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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 event_type, | 646 event_type, |
647 OS::TimeCurrentMillis(), | 647 OS::TimeCurrentMillis(), |
648 parameter_string); | 648 parameter_string); |
649 DeleteArray(parameter_string); | 649 DeleteArray(parameter_string); |
650 #endif | 650 #endif |
651 } | 651 } |
652 | 652 |
653 | 653 |
654 #ifdef ENABLE_LOGGING_AND_PROFILING | 654 #ifdef ENABLE_LOGGING_AND_PROFILING |
655 void Logger::TickEvent(TickSample* sample, bool overflow) { | 655 void Logger::TickEvent(TickSample* sample, bool overflow) { |
656 if (logfile_ == NULL || !FLAG_log) return; | 656 if (logfile_ == NULL || !FLAG_prof) return; |
657 ScopedLock sl(mutex_); | 657 ScopedLock sl(mutex_); |
658 fprintf(logfile_, "tick,0x%x,0x%x,%d", sample->pc, sample->sp, | 658 fprintf(logfile_, "tick,0x%x,0x%x,%d", sample->pc, sample->sp, |
659 static_cast<int>(sample->state)); | 659 static_cast<int>(sample->state)); |
660 if (overflow) fprintf(logfile_, ",overflow"); | 660 if (overflow) fprintf(logfile_, ",overflow"); |
661 fprintf(logfile_, "\n"); | 661 fprintf(logfile_, "\n"); |
662 } | 662 } |
663 #endif | 663 #endif |
664 | 664 |
665 | 665 |
666 bool Logger::Setup() { | 666 bool Logger::Setup() { |
667 #ifdef ENABLE_LOGGING_AND_PROFILING | 667 #ifdef ENABLE_LOGGING_AND_PROFILING |
668 // --log-all enables all the log flags. | 668 // --log-all enables all the log flags. |
669 if (FLAG_log_all) { | 669 if (FLAG_log_all) { |
670 FLAG_log_api = true; | 670 FLAG_log_api = true; |
671 FLAG_log_code = true; | 671 FLAG_log_code = true; |
672 FLAG_log_gc = true; | 672 FLAG_log_gc = true; |
673 FLAG_log_suspect = true; | 673 FLAG_log_suspect = true; |
674 FLAG_log_handles = true; | 674 FLAG_log_handles = true; |
675 FLAG_log_regexp = true; | 675 FLAG_log_regexp = true; |
676 } | 676 } |
677 | 677 |
678 // --prof implies --log-code. | 678 // --prof implies --log-code. |
679 if (FLAG_prof) FLAG_log_code = true; | 679 if (FLAG_prof) FLAG_log_code = true; |
680 if (FLAG_log_code) FLAG_log = true; | |
681 | 680 |
682 bool open_log_file = FLAG_log || FLAG_log_api || FLAG_log_code | 681 bool open_log_file = FLAG_log || FLAG_log_api || FLAG_log_code |
683 || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect | 682 || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect |
684 || FLAG_log_regexp; | 683 || FLAG_log_regexp; |
685 | 684 |
686 // If we're logging anything, we need to open the log file. | 685 // If we're logging anything, we need to open the log file. |
687 if (open_log_file) { | 686 if (open_log_file) { |
688 if (strcmp(FLAG_logfile, "-") == 0) { | 687 if (strcmp(FLAG_logfile, "-") == 0) { |
689 logfile_ = stdout; | 688 logfile_ = stdout; |
690 } else { | 689 } else { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 if (FLAG_log_state_changes) { | 797 if (FLAG_log_state_changes) { |
799 LOG(StringEvent("Leaving", StateToString(state_))); | 798 LOG(StringEvent("Leaving", StateToString(state_))); |
800 if (previous_) { | 799 if (previous_) { |
801 LOG(StringEvent("To", StateToString(previous_->state_))); | 800 LOG(StringEvent("To", StateToString(previous_->state_))); |
802 } | 801 } |
803 } | 802 } |
804 } | 803 } |
805 #endif | 804 #endif |
806 | 805 |
807 } } // namespace v8::internal | 806 } } // namespace v8::internal |
OLD | NEW |