synchronization

This commit is contained in:
2025-08-25 16:04:00 +08:00
commit 33f9b3ce46
1951 changed files with 854396 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package nvidia
import (
"io/ioutil"
"runtime"
log "github.com/golang/glog"
)
func StackTrace(all bool) string {
buf := make([]byte, 10240)
for {
size := runtime.Stack(buf, all)
if size == len(buf) {
buf = make([]byte, len(buf)<<1)
continue
}
break
}
return string(buf)
}
func coredump(fileName string) {
log.Infoln("Dump stacktrace to ", fileName)
ioutil.WriteFile(fileName, []byte(StackTrace(true)), 0644)
}