platform.go 900 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2013 Couchbase, Inc.
  2. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
  3. // except in compliance with the License. You may obtain a copy of the License at
  4. // http://www.apache.org/licenses/LICENSE-2.0
  5. // Unless required by applicable law or agreed to in writing, software distributed under the
  6. // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  7. // either express or implied. See the License for the specific language governing permissions
  8. // and limitations under the License.
  9. // +build !windows
  10. package platform
  11. import (
  12. _ "net/http/pprof"
  13. "os"
  14. "os/signal"
  15. "runtime/pprof"
  16. "syscall"
  17. )
  18. import "C"
  19. func DumpOnSignal() {
  20. c := make(chan os.Signal, 1)
  21. signal.Notify(c, syscall.SIGUSR2)
  22. for _ = range c {
  23. pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
  24. }
  25. }
  26. func HideConsole(_ bool) {
  27. }