<commit_before>package main

import (
	"fmt"
	"io"

	"github.com/mackerelio/go-osstat/cpu"
)

type cpuGenerator struct {
	cpu *cpu.Cpu
	err error
}

func (self *cpuGenerator) Get() {
	cpu, err := cpu.Get()
	if err != nil {
		self.err = err
		return
	}
	self.cpu = cpu
}

func (self *cpuGenerator) Error() error {
	return self.err
}

func (self *cpuGenerator) Print(out io.Writer) {
	cpu := self.cpu
	fmt.Fprintf(out, "cpu.user\t%f\t%%\n", cpu.User)
	fmt.Fprintf(out, "cpu.system\t%f\t%%\n", cpu.System)
	fmt.Fprintf(out, "cpu.idle\t%f\t%%\n", cpu.Idle)
}<commit_msg>osstat now prints cpu statistics in counter<commit_after>package main

import (
	"fmt"
	"io"

	"github.com/mackerelio/go-osstat/cpu"
)

type cpuGenerator struct {
	cpu *cpu.Cpu
	err error
}

func (self *cpuGenerator) Get() {
	cpu, err := cpu.Get()
	if err != nil {
		self.err = err
		return
	}
	self.cpu = cpu
}

func (self *cpuGenerator) Error() error {
	return self.err
}

func (self *cpuGenerator) Print(out io.Writer) {
	cpu := self.cpu
	fmt.Fprintf(out, "cpu.user\t%d\t-\n", cpu.User)
	fmt.Fprintf(out, "cpu.system\t%d\t-\n", cpu.System)
	fmt.Fprintf(out, "cpu.idle\t%d\t-\n", cpu.Idle)
	fmt.Fprintf(out, "cpu.nice\t%d\t-\n", cpu.Nice)
	fmt.Fprintf(out, "cpu.total\t%d\t-\n", cpu.Total)
}
{'fraction_non_alphanumeric': 0.18665607625099284, 'fraction_numerical': 0.0, 'mean_word_length': 3.5985401459854014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1499703', 'n_tokens_mistral': 556, 'n_tokens_neox': 549, 'n_words': 114}