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 // Malloc profiling. | 5 // Malloc profiling. |
6 // Patterned after tcmalloc's algorithms; shorter code. | 6 // Patterned after tcmalloc's algorithms; shorter code. |
7 | 7 |
8 package runtime | 8 package runtime |
9 #include "runtime.h" | 9 #include "runtime.h" |
10 #include "arch_GOARCH.h" | 10 #include "arch_GOARCH.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 runtime·memmove(r->stk, mp->createstack, sizeof r->stk); | 364 runtime·memmove(r->stk, mp->createstack, sizeof r->stk); |
365 r++; | 365 r++; |
366 } | 366 } |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 func Stack(b Slice, all bool) (n int) { | 370 func Stack(b Slice, all bool) (n int) { |
371 uintptr pc, sp; | 371 uintptr pc, sp; |
372 ········ | 372 ········ |
373 sp = runtime·getcallersp(&b); | 373 sp = runtime·getcallersp(&b); |
374 » pc = (uintptr)runtime·getcallerpc(&b); | 374 » pc = (uintptr)runtime·getcallerpc(&b)-1; |
375 | 375 |
376 if(all) { | 376 if(all) { |
377 runtime·semacquire(&runtime·worldsema, false); | 377 runtime·semacquire(&runtime·worldsema, false); |
378 m->gcing = 1; | 378 m->gcing = 1; |
379 runtime·stoptheworld(); | 379 runtime·stoptheworld(); |
380 } | 380 } |
381 | 381 |
382 if(b.len == 0) | 382 if(b.len == 0) |
383 n = 0; | 383 n = 0; |
384 else{ | 384 else{ |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 runtime·lock(&tracelock); | 506 runtime·lock(&tracelock); |
507 m->traceback = 2; | 507 m->traceback = 2; |
508 runtime·printf("tracegc()\n"); | 508 runtime·printf("tracegc()\n"); |
509 // running on m->g0 stack; show all non-g0 goroutines | 509 // running on m->g0 stack; show all non-g0 goroutines |
510 runtime·tracebackothers(g); | 510 runtime·tracebackothers(g); |
511 runtime·printf("end tracegc\n"); | 511 runtime·printf("end tracegc\n"); |
512 runtime·printf("\n"); | 512 runtime·printf("\n"); |
513 m->traceback = 0; | 513 m->traceback = 0; |
514 runtime·unlock(&tracelock); | 514 runtime·unlock(&tracelock); |
515 } | 515 } |
LEFT | RIGHT |