This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stap -g inject_accept.stp $pid | |
%{ | |
#include <net/sock.h> | |
%} | |
function set_sock_keepalive:long(fd) %{ | |
int err = -1; | |
int keepalive = 1; | |
struct socket *sock = sockfd_lookup(STAP_ARG_fd, &err); | |
if (sock != NULL) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +build !race | |
package sync1 | |
import "unsafe" | |
const enabled = false | |
func Acquire(addr unsafe.Pointer) {} | |
func Release(addr unsafe.Pointer) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code is used for testing the cost of mutex contention. | |
// If there are a lot goroutines fetch a mutex simultaneously, | |
// those goroutines will be woke up slowly which are waiting for | |
// the mutex. | |
package main | |
import ( | |
"flag" | |
"image" | |
"image/color" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func C(N, K int64) float64 { | |
a, b := 1.0, 1.0 | |
if N == 0 { |