LEFT | RIGHT |
(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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 p->wholding = false; | 353 p->wholding = false; |
354 } | 354 } |
355 ········ | 355 ········ |
356 if(p->flushing) | 356 if(p->flushing) |
357 goto flush; | 357 goto flush; |
358 ········ | 358 ········ |
359 if(!p->on && p->handoff == 0) | 359 if(!p->on && p->handoff == 0) |
360 return ret; | 360 return ret; |
361 | 361 |
362 // Wait for new log. | 362 // Wait for new log. |
363 » runtime·entersyscall(); | 363 » runtime·entersyscallblock(); |
364 runtime·notesleep(&p->wait); | 364 runtime·notesleep(&p->wait); |
365 runtime·exitsyscall(); | 365 runtime·exitsyscall(); |
366 runtime·noteclear(&p->wait); | 366 runtime·noteclear(&p->wait); |
367 | 367 |
368 n = p->handoff; | 368 n = p->handoff; |
369 if(n == 0) { | 369 if(n == 0) { |
370 runtime·printf("runtime: phase error during cpu profile wait\n")
; | 370 runtime·printf("runtime: phase error during cpu profile wait\n")
; |
371 return ret; | 371 return ret; |
372 } | 372 } |
373 if(n == 0x80000000) { | 373 if(n == 0x80000000) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 | 432 |
433 // CPUProfile returns the next cpu profile block as a []byte. | 433 // CPUProfile returns the next cpu profile block as a []byte. |
434 // The user documentation is in debug.go. | 434 // The user documentation is in debug.go. |
435 void | 435 void |
436 runtime·CPUProfile(Slice ret) | 436 runtime·CPUProfile(Slice ret) |
437 { | 437 { |
438 ret = getprofile(prof); | 438 ret = getprofile(prof); |
439 FLUSH(&ret); | 439 FLUSH(&ret); |
440 } | 440 } |
LEFT | RIGHT |