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

Side by Side Diff: src/pkg/runtime/pprof/pprof.go

Issue 160200044: [dev.power64] code review 160200044: build: merge default into dev.power64 (Closed)
Patch Set: diff -r be0c14f62257b42485019e9e1db23cf40d2e249f https://code.google.com/p/go Created 10 years, 4 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/runtime/parfor.c ('k') | src/pkg/runtime/pprof/pprof_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 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 // Package pprof writes runtime profiling data in the format expected 5 // Package pprof writes runtime profiling data in the format expected
6 // by the pprof visualization tool. 6 // by the pprof visualization tool.
7 // For more information about pprof, see 7 // For more information about pprof, see
8 // http://code.google.com/p/google-perftools/. 8 // http://code.google.com/p/google-perftools/.
9 package pprof 9 package pprof
10 10
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // but in practice operating systems cannot trigger signals 567 // but in practice operating systems cannot trigger signals
568 // at more than about 500 Hz, and our processing of the 568 // at more than about 500 Hz, and our processing of the
569 // signal is not cheap (mostly getting the stack trace). 569 // signal is not cheap (mostly getting the stack trace).
570 // 100 Hz is a reasonable choice: it is frequent enough to 570 // 100 Hz is a reasonable choice: it is frequent enough to
571 // produce useful data, rare enough not to bog down the 571 // produce useful data, rare enough not to bog down the
572 // system, and a nice round number to make it easy to 572 // system, and a nice round number to make it easy to
573 // convert sample counts to seconds. Instead of requiring 573 // convert sample counts to seconds. Instead of requiring
574 // each client to specify the frequency, we hard code it. 574 // each client to specify the frequency, we hard code it.
575 const hz = 100 575 const hz = 100
576 576
577 // Avoid queueing behind StopCPUProfile.
578 // Could use TryLock instead if we had it.
579 if cpu.profiling {
580 return fmt.Errorf("cpu profiling already in use")
581 }
582
583 cpu.Lock() 577 cpu.Lock()
584 defer cpu.Unlock() 578 defer cpu.Unlock()
585 if cpu.done == nil { 579 if cpu.done == nil {
586 cpu.done = make(chan bool) 580 cpu.done = make(chan bool)
587 } 581 }
588 // Double-check. 582 // Double-check.
589 if cpu.profiling { 583 if cpu.profiling {
590 return fmt.Errorf("cpu profiling already in use") 584 return fmt.Errorf("cpu profiling already in use")
591 } 585 }
592 cpu.profiling = true 586 cpu.profiling = true
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 664 }
671 } 665 }
672 666
673 if tw != nil { 667 if tw != nil {
674 tw.Flush() 668 tw.Flush()
675 } 669 }
676 return b.Flush() 670 return b.Flush()
677 } 671 }
678 672
679 func runtime_cyclesPerSecond() int64 673 func runtime_cyclesPerSecond() int64
OLDNEW
« no previous file with comments | « src/pkg/runtime/parfor.c ('k') | src/pkg/runtime/pprof/pprof_test.go » ('j') | no next file with comments »

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