LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "defs_GOOS_GOARCH.h" | 6 #include "defs_GOOS_GOARCH.h" |
7 #include "signals_GOOS.h" | 7 #include "signals_GOOS.h" |
8 #include "os_GOOS.h" | 8 #include "os_GOOS.h" |
9 | 9 |
10 void | 10 void |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 case AT_HWCAP: // CPU capability bit flags | 199 case AT_HWCAP: // CPU capability bit flags |
200 runtime·hwcap = auxv[1]; | 200 runtime·hwcap = auxv[1]; |
201 break; | 201 break; |
202 } | 202 } |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 #pragma textflag 7 | 206 #pragma textflag 7 |
207 int64 | 207 int64 |
208 runtime·cputicks() { | 208 runtime·cputicks() { |
209 » // copied from runtime.c:/^fastrand1 | 209 » // Currently cputicks() is used in blocking profiler and to seed runtime
·fastrand1(). |
210 » uint32 x; | 210 » // runtime·nanotime() is a poor approximation of CPU ticks that is enoug
h for the profiler. |
211 | 211 » // runtime·randomNumber provides better seeding of fastrand1. |
212 » x = runtime·randomNumber; | 212 » return runtime·nanotime() + runtime·randomNumber; |
213 » x += x; | 213 } |
214 » if(x & 0x80000000L) | |
215 » » x ^= 0x88888eefUL; | |
216 » runtime·randomNumber = x; | |
217 | |
218 » return ((int64)x) << 32 | x; | |
219 } | |
LEFT | RIGHT |