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

Delta Between Two Patch Sets: src/pkg/runtime/cpuprof.goc

Issue 140060043: code review 140060043: runtime: rename SysAlloc to sysAlloc for Go (Closed)
Left Patch Set: Created 10 years, 6 months ago
Right Patch Set: diff -r 7b4959d789778872173938218fc966d019401a3a https://code.google.com/p/go/ Created 10 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/runtime/heapdump.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 // CPU profiling. 5 // CPU profiling.
6 // Based on algorithms and data structures used in 6 // Based on algorithms and data structures used in
7 // http://code.google.com/p/google-perftools/. 7 // http://code.google.com/p/google-perftools/.
8 // 8 //
9 // The main difference between this code and the google-perftools 9 // The main difference between this code and the google-perftools
10 // code is that this code is written to allow copying the profile data 10 // code is that this code is written to allow copying the profile data
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 // Clamp hz to something reasonable. 131 // Clamp hz to something reasonable.
132 if(hz < 0) 132 if(hz < 0)
133 hz = 0; 133 hz = 0;
134 if(hz > 1000000) 134 if(hz > 1000000)
135 hz = 1000000; 135 hz = 1000000;
136 136
137 runtime·lock(&lk); 137 runtime·lock(&lk);
138 if(hz > 0) { 138 if(hz > 0) {
139 if(prof == nil) { 139 if(prof == nil) {
140 » » » prof = runtime·SysAlloc(sizeof *prof, &mstats.other_sys) ; 140 » » » prof = runtime·sysAlloc(sizeof *prof, &mstats.other_sys) ;
141 if(prof == nil) { 141 if(prof == nil) {
142 runtime·printf("runtime: cpu profiling cannot al locate memory\n"); 142 runtime·printf("runtime: cpu profiling cannot al locate memory\n");
143 runtime·unlock(&lk); 143 runtime·unlock(&lk);
144 return; 144 return;
145 } 145 }
146 } 146 }
147 if(prof->on || prof->handoff != 0) { 147 if(prof->on || prof->handoff != 0) {
148 runtime·printf("runtime: cannot set cpu profile rate unt il previous profile has finished.\n"); 148 runtime·printf("runtime: cannot set cpu profile rate unt il previous profile has finished.\n");
149 runtime·unlock(&lk); 149 runtime·unlock(&lk);
150 return; 150 return;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 if(!runtime·cas(&p->handoff, p->handoff, 0)) 424 if(!runtime·cas(&p->handoff, p->handoff, 0))
425 runtime·printf("runtime: profile flush racing with something\n") ; 425 runtime·printf("runtime: profile flush racing with something\n") ;
426 return ret; // set to nil at top of function 426 return ret; // set to nil at top of function
427 } 427 }
428 428
429 // CPUProfile returns the next cpu profile block as a []byte. 429 // CPUProfile returns the next cpu profile block as a []byte.
430 // The user documentation is in debug.go. 430 // The user documentation is in debug.go.
431 func CPUProfile() (ret Slice) { 431 func CPUProfile() (ret Slice) {
432 ret = getprofile(prof); 432 ret = getprofile(prof);
433 } 433 }
LEFTRIGHT

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