Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package main
import (
func main() {
accountingFileName := fmt.Sprintf("%s/%s/common/accounting", os.Getenv("SGE_ROOT"), os.Getenv("SGE_CELL"))
accountingFileName, 4,
).Filter(func(line string) bool {
return !strings.HasPrefix(line, "#")
}).Map(func(line string, ch chan accounting.Entry) {
if e, err := accounting.ParseLine([]byte(line)); err == nil {
ch <- e
}).Reduce(func(x accounting.Entry, y accounting.Entry) accounting.Entry {
y.CPU += x.CPU
return y
}).Map(func(out accounting.Entry) {
fmt.Println("Combined CPU times of all jobs.")
fmt.Printf("%f\n", out.CPU)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment