OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 #else | 1144 #else |
1145 syscall(SYS_tgkill, vm_tgid_, tid, SIGPROF); | 1145 syscall(SYS_tgkill, vm_tgid_, tid, SIGPROF); |
1146 #endif | 1146 #endif |
1147 } | 1147 } |
1148 | 1148 |
1149 void Sleep(SleepInterval full_or_half) { | 1149 void Sleep(SleepInterval full_or_half) { |
1150 // Convert ms to us and subtract 100 us to compensate delays | 1150 // Convert ms to us and subtract 100 us to compensate delays |
1151 // occuring during signal delivery. | 1151 // occuring during signal delivery. |
1152 useconds_t interval = interval_ * 1000 - 100; | 1152 useconds_t interval = interval_ * 1000 - 100; |
1153 if (full_or_half == HALF_INTERVAL) interval /= 2; | 1153 if (full_or_half == HALF_INTERVAL) interval /= 2; |
| 1154 #if defined(ANDROID) |
| 1155 usleep(interval); |
| 1156 #else |
1154 int result = usleep(interval); | 1157 int result = usleep(interval); |
1155 #ifdef DEBUG | 1158 #ifdef DEBUG |
1156 if (result != 0 && errno != EINTR) { | 1159 if (result != 0 && errno != EINTR) { |
1157 fprintf(stderr, | 1160 fprintf(stderr, |
1158 "SignalSender usleep error; interval = %u, errno = %d\n", | 1161 "SignalSender usleep error; interval = %u, errno = %d\n", |
1159 interval, | 1162 interval, |
1160 errno); | 1163 errno); |
1161 ASSERT(result == 0 || errno == EINTR); | 1164 ASSERT(result == 0 || errno == EINTR); |
1162 } | 1165 } |
1163 #endif | 1166 #endif // DEBUG |
1164 USE(result); | 1167 USE(result); |
| 1168 #endif // ANDROID |
1165 } | 1169 } |
1166 | 1170 |
1167 const int vm_tgid_; | 1171 const int vm_tgid_; |
1168 const int interval_; | 1172 const int interval_; |
1169 RuntimeProfilerRateLimiter rate_limiter_; | 1173 RuntimeProfilerRateLimiter rate_limiter_; |
1170 | 1174 |
1171 // Protects the process wide state below. | 1175 // Protects the process wide state below. |
1172 static Mutex* mutex_; | 1176 static Mutex* mutex_; |
1173 static SignalSender* instance_; | 1177 static SignalSender* instance_; |
1174 static bool signal_handler_installed_; | 1178 static bool signal_handler_installed_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 | 1212 |
1209 | 1213 |
1210 void Sampler::Stop() { | 1214 void Sampler::Stop() { |
1211 ASSERT(IsActive()); | 1215 ASSERT(IsActive()); |
1212 SignalSender::RemoveActiveSampler(this); | 1216 SignalSender::RemoveActiveSampler(this); |
1213 SetActive(false); | 1217 SetActive(false); |
1214 } | 1218 } |
1215 | 1219 |
1216 | 1220 |
1217 } } // namespace v8::internal | 1221 } } // namespace v8::internal |
OLD | NEW |