OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 FULL_INTERVAL | 1048 FULL_INTERVAL |
1049 }; | 1049 }; |
1050 | 1050 |
1051 static const int kSignalSenderStackSize = 64 * KB; | 1051 static const int kSignalSenderStackSize = 64 * KB; |
1052 | 1052 |
1053 explicit SignalSender(int interval) | 1053 explicit SignalSender(int interval) |
1054 : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)), | 1054 : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)), |
1055 vm_tgid_(getpid()), | 1055 vm_tgid_(getpid()), |
1056 interval_(interval) {} | 1056 interval_(interval) {} |
1057 | 1057 |
1058 static void SetUp() { | 1058 static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); } |
1059 if (!mutex_) { | 1059 static void TearDown() { delete mutex_; } |
1060 mutex_ = OS::CreateMutex(); | |
1061 } | |
1062 } | |
1063 | 1060 |
1064 static void InstallSignalHandler() { | 1061 static void InstallSignalHandler() { |
1065 struct sigaction sa; | 1062 struct sigaction sa; |
1066 sa.sa_sigaction = ProfilerSignalHandler; | 1063 sa.sa_sigaction = ProfilerSignalHandler; |
1067 sigemptyset(&sa.sa_mask); | 1064 sigemptyset(&sa.sa_mask); |
1068 sa.sa_flags = SA_RESTART | SA_SIGINFO; | 1065 sa.sa_flags = SA_RESTART | SA_SIGINFO; |
1069 signal_handler_installed_ = | 1066 signal_handler_installed_ = |
1070 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0); | 1067 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0); |
1071 } | 1068 } |
1072 | 1069 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 PrintF("ERROR: Binary not compiled with -mfloat-abi=hard but with " | 1228 PrintF("ERROR: Binary not compiled with -mfloat-abi=hard but with " |
1232 "-DUSE_EABI_HARDFLOAT\n"); | 1229 "-DUSE_EABI_HARDFLOAT\n"); |
1233 exit(1); | 1230 exit(1); |
1234 #endif | 1231 #endif |
1235 } | 1232 } |
1236 #endif | 1233 #endif |
1237 SignalSender::SetUp(); | 1234 SignalSender::SetUp(); |
1238 } | 1235 } |
1239 | 1236 |
1240 | 1237 |
| 1238 void OS::TearDown() { |
| 1239 SignalSender::TearDown(); |
| 1240 delete limit_mutex; |
| 1241 } |
| 1242 |
| 1243 |
1241 Sampler::Sampler(Isolate* isolate, int interval) | 1244 Sampler::Sampler(Isolate* isolate, int interval) |
1242 : isolate_(isolate), | 1245 : isolate_(isolate), |
1243 interval_(interval), | 1246 interval_(interval), |
1244 profiling_(false), | 1247 profiling_(false), |
1245 active_(false), | 1248 active_(false), |
1246 samples_taken_(0) { | 1249 samples_taken_(0) { |
1247 data_ = new PlatformData; | 1250 data_ = new PlatformData; |
1248 } | 1251 } |
1249 | 1252 |
1250 | 1253 |
(...skipping 11 matching lines...) Expand all Loading... |
1262 | 1265 |
1263 | 1266 |
1264 void Sampler::Stop() { | 1267 void Sampler::Stop() { |
1265 ASSERT(IsActive()); | 1268 ASSERT(IsActive()); |
1266 SignalSender::RemoveActiveSampler(this); | 1269 SignalSender::RemoveActiveSampler(this); |
1267 SetActive(false); | 1270 SetActive(false); |
1268 } | 1271 } |
1269 | 1272 |
1270 | 1273 |
1271 } } // namespace v8::internal | 1274 } } // namespace v8::internal |
OLD | NEW |