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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 if(all) | 348 if(all) |
349 runtime·tracebackothers(g); | 349 runtime·tracebackothers(g); |
350 n = b.len - g->writenbuf; | 350 n = b.len - g->writenbuf; |
351 g->writebuf = nil; | 351 g->writebuf = nil; |
352 g->writenbuf = 0; | 352 g->writenbuf = 0; |
353 } | 353 } |
354 ········ | 354 ········ |
355 if(all) { | 355 if(all) { |
356 m->gcing = 0; | 356 m->gcing = 0; |
357 runtime·semrelease(&runtime·worldsema); | 357 runtime·semrelease(&runtime·worldsema); |
358 » » runtime·starttheworld(false); | 358 » » runtime·starttheworld(); |
359 } | 359 } |
360 } | 360 } |
361 | 361 |
362 static void | 362 static void |
363 saveg(byte *pc, byte *sp, G *g, TRecord *r) | 363 saveg(byte *pc, byte *sp, G *g, TRecord *r) |
364 { | 364 { |
365 int32 n; | 365 int32 n; |
366 ········ | 366 ········ |
367 n = runtime·gentraceback(pc, sp, 0, g, 0, r->stk, nelem(r->stk)); | 367 n = runtime·gentraceback(pc, sp, 0, g, 0, r->stk, nelem(r->stk)); |
368 if(n < nelem(r->stk)) | 368 if(n < nelem(r->stk)) |
(...skipping 22 matching lines...) Expand all Loading... |
391 saveg(pc, sp, g, r++); | 391 saveg(pc, sp, g, r++); |
392 for(gp = runtime·allg; gp != nil; gp = gp->alllink) { | 392 for(gp = runtime·allg; gp != nil; gp = gp->alllink) { |
393 if(gp == g || gp->status == Gdead) | 393 if(gp == g || gp->status == Gdead) |
394 continue; | 394 continue; |
395 saveg(gp->sched.pc, gp->sched.sp, gp, r++); | 395 saveg(gp->sched.pc, gp->sched.sp, gp, r++); |
396 } | 396 } |
397 } | 397 } |
398 ········ | 398 ········ |
399 m->gcing = 0; | 399 m->gcing = 0; |
400 runtime·semrelease(&runtime·worldsema); | 400 runtime·semrelease(&runtime·worldsema); |
401 » » runtime·starttheworld(false); | 401 » » runtime·starttheworld(); |
402 » } | 402 » } |
403 } | 403 } |
404 | 404 |
LEFT | RIGHT |