OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [runtime/] [debug.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2009 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
package runtime
6
 
7
// Breakpoint() executes a breakpoint trap.
8
func Breakpoint()
9
 
10
// LockOSThread wires the calling goroutine to its current operating system thread.
11
// Until the calling goroutine exits or calls UnlockOSThread, it will always
12
// execute in that thread, and no other goroutine can.
13
func LockOSThread()
14
 
15
// UnlockOSThread unwires the calling goroutine from its fixed operating system thread.
16
// If the calling goroutine has not called LockOSThread, UnlockOSThread is a no-op.
17
func UnlockOSThread()
18
 
19
// GOMAXPROCS sets the maximum number of CPUs that can be executing
20
// simultaneously and returns the previous setting.  If n < 1, it does not
21
// change the current setting.
22
// The number of logical CPUs on the local machine can be queried with NumCPU.
23
// This call will go away when the scheduler improves.
24
func GOMAXPROCS(n int) int
25
 
26
// NumCPU returns the number of logical CPUs on the local machine.
27
func NumCPU() int
28
 
29
// Cgocalls returns the number of cgo calls made by the current process.
30
func Cgocalls() int64
31
 
32
// Goroutines returns the number of goroutines that currently exist.
33
func Goroutines() int32
34
 
35
// Alloc allocates a block of the given size.
36
// FOR TESTING AND DEBUGGING ONLY.
37
func Alloc(uintptr) *byte
38
 
39
// Free frees the block starting at the given pointer.
40
// FOR TESTING AND DEBUGGING ONLY.
41
func Free(*byte)
42
 
43
// Lookup returns the base and size of the block containing the given pointer.
44
// FOR TESTING AND DEBUGGING ONLY.
45
func Lookup(*byte) (*byte, uintptr)
46
 
47
// MemProfileRate controls the fraction of memory allocations
48
// that are recorded and reported in the memory profile.
49
// The profiler aims to sample an average of
50
// one allocation per MemProfileRate bytes allocated.
51
//
52
// To include every allocated block in the profile, set MemProfileRate to 1.
53
// To turn off profiling entirely, set MemProfileRate to 0.
54
//
55
// The tools that process the memory profiles assume that the
56
// profile rate is constant across the lifetime of the program
57
// and equal to the current value.  Programs that change the
58
// memory profiling rate should do so just once, as early as
59
// possible in the execution of the program (for example,
60
// at the beginning of main).
61
var MemProfileRate int = 512 * 1024
62
 
63
// A MemProfileRecord describes the live objects allocated
64
// by a particular call sequence (stack trace).
65
type MemProfileRecord struct {
66
        AllocBytes, FreeBytes     int64       // number of bytes allocated, freed
67
        AllocObjects, FreeObjects int64       // number of objects allocated, freed
68
        Stack0                    [32]uintptr // stack trace for this record; ends at first 0 entry
69
}
70
 
71
// InUseBytes returns the number of bytes in use (AllocBytes - FreeBytes).
72
func (r *MemProfileRecord) InUseBytes() int64 { return r.AllocBytes - r.FreeBytes }
73
 
74
// InUseObjects returns the number of objects in use (AllocObjects - FreeObjects).
75
func (r *MemProfileRecord) InUseObjects() int64 {
76
        return r.AllocObjects - r.FreeObjects
77
}
78
 
79
// Stack returns the stack trace associated with the record,
80
// a prefix of r.Stack0.
81
func (r *MemProfileRecord) Stack() []uintptr {
82
        for i, v := range r.Stack0 {
83
                if v == 0 {
84
                        return r.Stack0[0:i]
85
                }
86
        }
87
        return r.Stack0[0:]
88
}
89
 
90
// MemProfile returns n, the number of records in the current memory profile.
91
// If len(p) >= n, MemProfile copies the profile into p and returns n, true.
92
// If len(p) < n, MemProfile does not change p and returns n, false.
93
//
94
// If inuseZero is true, the profile includes allocation records
95
// where r.AllocBytes > 0 but r.AllocBytes == r.FreeBytes.
96
// These are sites where memory was allocated, but it has all
97
// been released back to the runtime.
98
// Most clients should use the runtime/pprof package or
99
// the testing package's -test.memprofile flag instead
100
// of calling MemProfile directly.
101
func MemProfile(p []MemProfileRecord, inuseZero bool) (n int, ok bool)
102
 
103
// CPUProfile returns the next chunk of binary CPU profiling stack trace data,
104
// blocking until data is available.  If profiling is turned off and all the profile
105
// data accumulated while it was on has been returned, CPUProfile returns nil.
106
// The caller must save the returned data before calling CPUProfile again.
107
// Most clients should use the runtime/pprof package or
108
// the testing package's -test.cpuprofile flag instead of calling
109
// CPUProfile directly.
110
func CPUProfile() []byte
111
 
112
// SetCPUProfileRate sets the CPU profiling rate to hz samples per second.
113
// If hz <= 0, SetCPUProfileRate turns off profiling.
114
// If the profiler is on, the rate cannot be changed without first turning it off.
115
// Most clients should use the runtime/pprof package or
116
// the testing package's -test.cpuprofile flag instead of calling
117
// SetCPUProfileRate directly.
118
func SetCPUProfileRate(hz int)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.