Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(26)

Issue 101380044: runtime: support for always-on background profiling

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 4 months ago by rsc
Modified:
12 years, 4 months ago
Reviewers:
dvyukov
Visibility:
Public.

Description

runtime: support for always-on background profiling

Patch Set 1 #

Patch Set 2 : diff -r f15ad332ce13 https://code.google.com/p/go/ #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+484 lines, -21 lines) Patch
M src/pkg/runtime/cpuprof.goc View 1 2 chunks +5 lines, -3 lines 0 comments Download
M src/pkg/runtime/mheap.c View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/runtime/mprof.goc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M src/pkg/runtime/proc.c View 1 10 chunks +50 lines, -18 lines 1 comment Download
A src/pkg/runtime/prof.h View 1 0 chunks +-1 lines, --1 lines 0 comments Download
A src/pkg/runtime/prof.c View 1 1 chunk +290 lines, -0 lines 8 comments Download
A src/pkg/runtime/prof.go View 1 1 chunk +58 lines, -0 lines 1 comment Download
A src/pkg/runtime/prof_test.go View 1 1 chunk +55 lines, -0 lines 1 comment Download
M src/pkg/runtime/runtime.h View 1 5 chunks +24 lines, -1 line 1 comment Download

Messages

Total messages: 3
dvyukov
runtime/prof.h is empty, remove? https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/runtime.h File src/pkg/runtime/runtime.h (right): https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/runtime.h#newcode96 src/pkg/runtime/runtime.h:96: typedef struct ProfBuf ProfBuf; tab ...
12 years, 4 months ago (2014-06-20 05:22:58 UTC) #1
dvyukov
https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/proc.c File src/pkg/runtime/proc.c (right): https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/proc.c#newcode2362 src/pkg/runtime/proc.c:2362: runtime·resetcpuprofiler(0); I think here is some potential for deadlocking. ...
12 years, 4 months ago (2014-06-20 05:50:55 UTC) #2
dvyukov
12 years, 4 months ago (2014-06-21 18:30:38 UTC) #3
https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c
File src/pkg/runtime/prof.c (right):

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:1: #include "runtime.h"
copyright?

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:6: runtime·newprofbuf(int32 hdrsize, int32 bufwords)
what is this hdr/hdrsize?
can we drop it?

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:13: size = bufwords*8 + sizeof(ProfBuf);
size = ROUND(bufwords*8 + sizeof(ProfBuf), PhysPageSize)

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:49: if(b->w + n - b->r > b->max) {
as of now this is x86 only at best
you need to read b->r once with atomicload and update b->w with atomicstore
and the opposite in profread

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:51: if(!b->full) {
this will be way simpler if you construct the overflow entry in profread:
add single overflow counter to bgprof, atomically increment it on overflow
if the counter is not zero, profread reads and sets it to zero with atomic xchg
and constructs the overflow entry
that's it

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:98: *wp = g->proftag; // prof tag
profiler does not run in the context of a user goroutine, you need to pass gp
from above

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:166: runtime·EnableProfCPU(intgo hz, intgo bufwords)
for 1.4 it will need to be in Go
probably all user-callable functions here just need to switch to g0

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.c#ne...
src/pkg/runtime/prof.c:287: runtime·printf("read %d\n", ret);
remove

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.go
File src/pkg/runtime/prof.go (right):

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof.go#n...
src/pkg/runtime/prof.go:1: package runtime
copyright?

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof_test.go
File src/pkg/runtime/prof_test.go (right):

https://codereview.appspot.com/101380044/diff/20001/src/pkg/runtime/prof_test...
src/pkg/runtime/prof_test.go:1: package runtime_test
copyright?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b