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

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

Issue 12418043: code review 12418043: net: add special netFD mutex (Closed)
Left Patch Set: diff -r adc2b4f10096 https://dvyukov%40google.com@code.google.com/p/go/ Created 11 years, 7 months ago
Right Patch Set: diff -r 5a51d54e34bb https://dvyukov%40google.com@code.google.com/p/go/ Created 11 years, 7 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 | « src/pkg/runtime/mgc0.c ('k') | src/pkg/runtime/netpoll.goc » ('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 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 } 441 }
442 442
443 func Stack(b Slice, all bool) (n int) { 443 func Stack(b Slice, all bool) (n int) {
444 uintptr pc, sp; 444 uintptr pc, sp;
445 ········ 445 ········
446 sp = runtime·getcallersp(&b); 446 sp = runtime·getcallersp(&b);
447 pc = (uintptr)runtime·getcallerpc(&b); 447 pc = (uintptr)runtime·getcallerpc(&b);
448 448
449 if(all) { 449 if(all) {
450 » » runtime·semacquire(&runtime·worldsema); 450 » » runtime·semacquire(&runtime·worldsema, false);
451 m->gcing = 1; 451 m->gcing = 1;
452 runtime·stoptheworld(); 452 runtime·stoptheworld();
453 } 453 }
454 454
455 if(b.len == 0) 455 if(b.len == 0)
456 n = 0; 456 n = 0;
457 else{ 457 else{
458 g->writebuf = (byte*)b.array; 458 g->writebuf = (byte*)b.array;
459 g->writenbuf = b.len; 459 g->writenbuf = b.len;
460 runtime·goroutineheader(g); 460 runtime·goroutineheader(g);
(...skipping 26 matching lines...) Expand all
487 uintptr pc, sp; 487 uintptr pc, sp;
488 TRecord *r; 488 TRecord *r;
489 G *gp; 489 G *gp;
490 ········ 490 ········
491 sp = runtime·getcallersp(&b); 491 sp = runtime·getcallersp(&b);
492 pc = (uintptr)runtime·getcallerpc(&b); 492 pc = (uintptr)runtime·getcallerpc(&b);
493 ········ 493 ········
494 ok = false; 494 ok = false;
495 n = runtime·gcount(); 495 n = runtime·gcount();
496 if(n <= b.len) { 496 if(n <= b.len) {
497 » » runtime·semacquire(&runtime·worldsema); 497 » » runtime·semacquire(&runtime·worldsema, false);
498 m->gcing = 1; 498 m->gcing = 1;
499 runtime·stoptheworld(); 499 runtime·stoptheworld();
500 500
501 n = runtime·gcount(); 501 n = runtime·gcount();
502 if(n <= b.len) { 502 if(n <= b.len) {
503 ok = true; 503 ok = true;
504 r = (TRecord*)b.array; 504 r = (TRecord*)b.array;
505 saveg(pc, sp, g, r++); 505 saveg(pc, sp, g, r++);
506 for(gp = runtime·allg; gp != nil; gp = gp->alllink) { 506 for(gp = runtime·allg; gp != nil; gp = gp->alllink) {
507 if(gp == g || gp->status == Gdead) 507 if(gp == g || gp->status == Gdead)
508 continue; 508 continue;
509 saveg(gp->sched.pc, gp->sched.sp, gp, r++); 509 saveg(gp->sched.pc, gp->sched.sp, gp, r++);
510 } 510 }
511 } 511 }
512 ········ 512 ········
513 m->gcing = 0; 513 m->gcing = 0;
514 runtime·semrelease(&runtime·worldsema); 514 runtime·semrelease(&runtime·worldsema);
515 runtime·starttheworld(); 515 runtime·starttheworld();
516 } 516 }
517 } 517 }
518 518
519 void 519 void
520 runtime·mprofinit(void) 520 runtime·mprofinit(void)
521 { 521 {
522 addrhash = runtime·persistentalloc((1<<AddrHashBits)*sizeof *addrhash, 0 ); 522 addrhash = runtime·persistentalloc((1<<AddrHashBits)*sizeof *addrhash, 0 );
523 } 523 }
LEFTRIGHT

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