See https://github.com/prometheus/client_golang/blob/master/prometheus/process_collector.go for the go implementation.