File tree 4 files changed +49
-22
lines changed 4 files changed +49
-22
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ func (p *Profile) Empty() bool {
45
45
46
46
func (p * Profile ) WriteFunctions (fout io.Writer ) error {
47
47
e := json .NewEncoder (fout )
48
- e .SetIndent ("" , " " )
48
+ // e.SetIndent("", " ")
49
49
return e .Encode (ExportFunctions (p .Funcs ))
50
50
}
51
51
Original file line number Diff line number Diff line change
1
+ // +build 1.9
2
+
3
+ package runtime
4
+
5
+ import "unsafe"
6
+
7
+ // GetCallerPC, finds the PC (program counter) of the function
8
+ // that calls this function. So if you have
9
+ //
10
+ // func foo() int {
11
+ // bar(7)
12
+ // return 1
13
+ // }
14
+ //
15
+ // func bar(wacky int) {
16
+ // runtime.GetCallerPC(unsafe.Pointer(&wacky))
17
+ // }
18
+ //
19
+ // you will get the pc of `return 1` in foo. This works a lot like
20
+ // the built-in Caller() function but is massively less safe calling
21
+ // the compiler intrinsic getcallerpc(.) directly.
22
+ func GetCallerPC (arg0 unsafe.Pointer ) uintptr {
23
+ return uintptr (getcallerpc ())
24
+ }
Original file line number Diff line number Diff line change 1
1
package runtime
2
2
3
- import "unsafe"
4
-
5
3
// Get the current goroutine's id
6
4
func GoID () int64 {
7
5
g := getg ()
8
6
return g .goid
9
7
}
10
8
11
- // GetCallerPC, finds the PC (program counter) of the function
12
- // that calls this function. So if you have
13
- //
14
- // func foo() int {
15
- // bar(7)
16
- // return 1
17
- // }
18
- //
19
- // func bar(wacky int) {
20
- // runtime.GetCallerPC(unsafe.Pointer(&wacky))
21
- // }
22
- //
23
- // you will get the pc of `return 1` in foo. This works a lot like
24
- // the built-in Caller() function but is massively less safe calling
25
- // the compiler intrinsic getcallerpc(.) directly.
26
- func GetCallerPC (arg0 unsafe.Pointer ) uintptr {
27
- return uintptr (getcallerpc ())
28
- }
29
-
30
9
func Wacky () string {
31
10
return "wacky"
32
11
}
Original file line number Diff line number Diff line change
1
+ // +build !go1.9
2
+
3
+ package runtime
4
+
5
+ import "unsafe"
6
+
7
+ // GetCallerPC, finds the PC (program counter) of the function
8
+ // that calls this function. So if you have
9
+ //
10
+ // func foo() int {
11
+ // bar(7)
12
+ // return 1
13
+ // }
14
+ //
15
+ // func bar(wacky int) {
16
+ // runtime.GetCallerPC(unsafe.Pointer(&wacky))
17
+ // }
18
+ //
19
+ // you will get the pc of `return 1` in foo. This works a lot like
20
+ // the built-in Caller() function but is massively less safe calling
21
+ // the compiler intrinsic getcallerpc(.) directly.
22
+ func GetCallerPC (arg0 unsafe.Pointer ) uintptr {
23
+ return uintptr (getcallerpc (arg0 ))
24
+ }
You can’t perform that action at this time.
0 commit comments