aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-04 00:54:06 -0400
committerRuss Cox <rsc@golang.org>2014-09-04 00:54:06 -0400
commite3edfea07f905916cee66121576b029cd6a11444 (patch)
treea86ddfc5ae7333371708dd0041fb6ac052694309 /src/pkg/runtime/runtime.c
parent32ecf57d22cfdf3af9419db515eba85fa1d5b67d (diff)
downloadgo-e3edfea07f905916cee66121576b029cd6a11444.tar.xz
runtime: correct various Go -> C function calls
Some things get converted. Other things (too complex or too many C deps) get onM calls. Other things (too simple) get #pragma textflag NOSPLIT. After this CL, the offending function list is basically: - panic.c - netpoll.goc - mem*.c - race stuff - readgstatus - entersyscall/exitsyscall LGTM=r, iant R=golang-codereviews, r, iant CC=dvyukov, golang-codereviews, khr https://golang.org/cl/140930043
Diffstat (limited to 'src/pkg/runtime/runtime.c')
-rw-r--r--src/pkg/runtime/runtime.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c
index b0adfb601b..751181274a 100644
--- a/src/pkg/runtime/runtime.c
+++ b/src/pkg/runtime/runtime.c
@@ -20,6 +20,7 @@ static uint32 traceback_cache = 2<<1;
// GOTRACEBACK=1 default behavior - show tracebacks but exclude runtime frames
// GOTRACEBACK=2 show tracebacks including runtime frames
// GOTRACEBACK=crash show tracebacks including runtime frames, then crash (core dump etc)
+#pragma textflag NOSPLIT
int32
runtime·gotraceback(bool *crash)
{
@@ -266,37 +267,6 @@ runtime·check(void)
runtime·throw("FixedStack is not power-of-2");
}
-static Mutex ticksLock;
-static int64 ticks;
-
-// Note: Called by runtime/pprof in addition to runtime code.
-int64
-runtime·tickspersecond(void)
-{
- int64 res, t0, t1, c0, c1;
-
- res = (int64)runtime·atomicload64((uint64*)&ticks);
- if(res != 0)
- return ticks;
- runtime·lock(&ticksLock);
- res = ticks;
- if(res == 0) {
- t0 = runtime·nanotime();
- c0 = runtime·cputicks();
- runtime·usleep(100*1000);
- t1 = runtime·nanotime();
- c1 = runtime·cputicks();
- if(t1 == t0)
- t1++;
- res = (c1-c0)*1000*1000*1000/(t1-t0);
- if(res == 0)
- res++;
- runtime·atomicstore64((uint64*)&ticks, res);
- }
- runtime·unlock(&ticksLock);
- return res;
-}
-
#pragma dataflag NOPTR
DebugVars runtime·debug;