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

Side by Side Diff: src/platform-linux.cc

Issue 4197002: Profiler on linux: use SA_RESTART signal flag to have most of the syscalls restarted for us. (Closed)
Patch Set: Created 10 years, 1 month 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 | « no previous file | no next file » | 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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 849
850 void Sampler::Start() { 850 void Sampler::Start() {
851 // There can only be one active sampler at the time on POSIX 851 // There can only be one active sampler at the time on POSIX
852 // platforms. 852 // platforms.
853 if (active_sampler_ != NULL) return; 853 if (active_sampler_ != NULL) return;
854 854
855 // Request profiling signals. 855 // Request profiling signals.
856 struct sigaction sa; 856 struct sigaction sa;
857 sa.sa_sigaction = ProfilerSignalHandler; 857 sa.sa_sigaction = ProfilerSignalHandler;
858 sigemptyset(&sa.sa_mask); 858 sigemptyset(&sa.sa_mask);
859 sa.sa_flags = SA_SIGINFO; 859 sa.sa_flags = SA_RESTART | SA_SIGINFO;
860 if (sigaction(SIGPROF, &sa, &data_->old_signal_handler_) != 0) return; 860 if (sigaction(SIGPROF, &sa, &data_->old_signal_handler_) != 0) return;
861 data_->signal_handler_installed_ = true; 861 data_->signal_handler_installed_ = true;
862 862
863 // Start a thread that sends SIGPROF signal to VM thread. 863 // Start a thread that sends SIGPROF signal to VM thread.
864 // Sending the signal ourselves instead of relying on itimer provides 864 // Sending the signal ourselves instead of relying on itimer provides
865 // much better accuracy. 865 // much better accuracy.
866 active_ = true; 866 active_ = true;
867 if (pthread_create( 867 if (pthread_create(
868 &data_->signal_sender_thread_, NULL, SenderEntry, data_) == 0) { 868 &data_->signal_sender_thread_, NULL, SenderEntry, data_) == 0) {
869 data_->signal_sender_launched_ = true; 869 data_->signal_sender_launched_ = true;
(...skipping 21 matching lines...) Expand all
891 } 891 }
892 892
893 // This sampler is no longer the active sampler. 893 // This sampler is no longer the active sampler.
894 active_sampler_ = NULL; 894 active_sampler_ = NULL;
895 } 895 }
896 896
897 897
898 #endif // ENABLE_LOGGING_AND_PROFILING 898 #endif // ENABLE_LOGGING_AND_PROFILING
899 899
900 } } // namespace v8::internal 900 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698