perfmonger 0.11.1 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +6 -9
  3. data/NEWS +36 -0
  4. data/README.md +1 -1
  5. data/Rakefile +20 -7
  6. data/core/Makefile +26 -19
  7. data/core/build.sh +5 -7
  8. data/core/{perfmonger-player.go → cmd/perfmonger-player/perfmonger-player.go} +53 -10
  9. data/core/{perfmonger-plot-formatter.go → cmd/perfmonger-plot-formatter/perfmonger-plot-formatter.go} +2 -1
  10. data/core/{perfmonger-recorder.go → cmd/perfmonger-recorder/perfmonger-recorder.go} +6 -0
  11. data/core/{perfmonger-summarizer.go → cmd/perfmonger-summarizer/perfmonger-summarizer.go} +4 -2
  12. data/core/cmd/perfmonger-viewer/perfmonger-viewer.go +164 -0
  13. data/core/go.mod +10 -0
  14. data/core/go.sum +17 -0
  15. data/core/subsystem/Makefile +4 -0
  16. data/core/subsystem/perfmonger_linux.go +95 -0
  17. data/core/subsystem/perfmonger_linux_test.go +40 -0
  18. data/core/subsystem/stat.go +70 -0
  19. data/core/subsystem/stat_test.go +9 -0
  20. data/core/subsystem/usage.go +80 -0
  21. data/core/utils.go +2 -2
  22. data/lib/exec/perfmonger-player_darwin_amd64 +0 -0
  23. data/lib/exec/perfmonger-player_linux_amd64 +0 -0
  24. data/lib/exec/perfmonger-plot-formatter_darwin_amd64 +0 -0
  25. data/lib/exec/perfmonger-plot-formatter_linux_amd64 +0 -0
  26. data/lib/exec/perfmonger-recorder_darwin_amd64 +0 -0
  27. data/lib/exec/perfmonger-recorder_linux_amd64 +0 -0
  28. data/lib/exec/perfmonger-summarizer_darwin_amd64 +0 -0
  29. data/lib/exec/perfmonger-summarizer_linux_amd64 +0 -0
  30. data/lib/exec/perfmonger-viewer_darwin_amd64 +0 -0
  31. data/lib/exec/perfmonger-viewer_linux_amd64 +0 -0
  32. data/lib/perfmonger/command/play.rb +10 -0
  33. data/lib/perfmonger/command/plot.rb +9 -1
  34. data/lib/perfmonger/command/record.rb +23 -2
  35. data/lib/perfmonger/command/record_option.rb +16 -0
  36. data/lib/perfmonger/version.rb +1 -1
  37. data/misc/werker-box/Dockerfile +16 -17
  38. data/misc/werker-box/build-push.sh +4 -2
  39. data/wercker.yml +12 -30
  40. metadata +13 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 238da9d952389a0d84f3e619631bb907d604b98a
4
- data.tar.gz: 982086728c90cd798a1ae0316af2cb1e23c87370
2
+ SHA256:
3
+ metadata.gz: 1a2bc69e72d02745481dafb5bec13073d4289a3f38cdf8eb253416e649e56ff5
4
+ data.tar.gz: fd5db8b9b288b62060df2ab5881ec8c777c320479d53420ddef3e4420ade9c9a
5
5
  SHA512:
6
- metadata.gz: 77b4709a0399f3c3725488b5005ee27028eb5231ae1dc8523c5dc24a92c4adfd8db92e65eba696de7533712e2817923f87edb3582df468fc02b340b1819d5dd9
7
- data.tar.gz: 4fffefe769a436e2456f57c4bef540dbd95f0c4a43d92b392c913c7f472bb8ae7b2d4c8f5f8275f29fe5b89a2576969fe25f5266d8546e45ccfc3289bfd9dbfa
6
+ metadata.gz: c7184d7eeb69b60188a740031143eede5188b56dbf84cd6a4bdd28302439faba79f390f8baf27f1e33275d04355c1e99c42eb09b1eb663a243c0046e1cc5a29e
7
+ data.tar.gz: cda569ba86554c985e46249d77d1fdc606fbe126150591dcec55ccbe82eabd13b6081ed428c6b7301004c1955fdf00273549a82696f6ed07cd3c2bb55387dd45
data/.travis.yml CHANGED
@@ -4,23 +4,20 @@ install:
4
4
  - sudo apt-get install gnuplot
5
5
  - gnuplot -e "set terminal" < /dev/null 2>&1
6
6
  - bundle install
7
- - go_version="1.8.3"
7
+ - go_version="1.14.1"
8
8
  - wget http://golang.org/dl/go${go_version}.linux-amd64.tar.gz
9
9
  - sudo tar -C /usr/local -xzf go${go_version}.linux-amd64.tar.gz
10
10
  - export PATH=$PATH:/usr/local/go/bin
11
11
  - export GOPATH="$HOME/go"
12
12
  - export PATH="$PATH:$GOPATH/bin"
13
13
  - mkdir -p "$HOME/go/{src,pkg,bin}"
14
- - go get -u github.com/mattn/go-isatty
15
- - go get -u github.com/hayamiz/go-projson
16
- - go get -u golang.org/x/crypto/ssh/terminal
17
- - go get -u github.com/hayamiz/perfmonger/core/subsystem
18
14
  rvm:
19
- - 1.9.3
20
- - 2.0.0
21
- - 2.1.5
22
- - 2.2.0
15
+ - 2.4.9
16
+ - 2.5.7
17
+ - 2.6.5
18
+ - 2.7.0
23
19
  script:
20
+ - rake go_get
24
21
  - rake spec
25
22
  - rake test_core
26
23
  notifications:
data/NEWS CHANGED
@@ -1,3 +1,39 @@
1
+ ## 2021-XX-XX: PerfMonger 0.14.0
2
+
3
+ ## 2021-07-26: PerfMonger 0.13.1
4
+ * New features
5
+ * [play] subcommand:
6
+ * Added --disk-only option to filter results of not interesting disks
7
+ * Note: v0.13.0 is yanked from rubygems.org
8
+
9
+ ## 2021-07-08: PerfMonger 0.12.1
10
+ * Bug fixes
11
+ * [record] subcommand:
12
+ * --kill waits until a recorder process surely exits
13
+
14
+ ## 2021-05-10: PerfMonger 0.12.0
15
+ * New features
16
+ * [record] subcommand:
17
+ * Add memory usage collection
18
+
19
+ ## 2021-02-10: PerfMonger 0.11.3
20
+ * Bug fixes
21
+ * [plot] subcommand:
22
+ * Fall back to available gnuplot terminal
23
+ * Changes
24
+ * [plot] subcommand:
25
+ * Added --with-gnuplot option for specifying gnuplot binary
26
+
27
+ ## 2020-03-31: PerfMonger 0.11.2
28
+ * Bug fixes
29
+ * [plot] subcommand:
30
+ * Remove temporary directory correctly
31
+ * Changes
32
+ * CI environment
33
+ * Changed golang version to 1.14
34
+ * Dropped support of ruby older than 2.4
35
+ * Added ruby 2.6 and 2.7
36
+
1
37
  ## 2018-05-15: PerfMonger 0.11.1
2
38
  * Bug fixes
3
39
  * [record] subcommand:
data/README.md CHANGED
@@ -26,7 +26,7 @@ You need gnuplot 4.6.0 or later build with cairo terminals for plotting measurem
26
26
 
27
27
  ### Build from source
28
28
 
29
- You need Ruby 1.9.3 or later, and Go 1.8 or later to build perfmonger.
29
+ You need Ruby 2.2 or later, and Go 1.8 or later to build perfmonger.
30
30
 
31
31
  bundle
32
32
  rake build
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rspec/core/rake_task'
3
3
  require "bundler/gem_tasks"
4
4
 
5
- task :default => [:spec, :test_core]
5
+ task :default => [:spec, :test_core, :analyze_core]
6
6
 
7
7
  desc "Run all specs in spec directory"
8
8
  RSpec::Core::RakeTask.new(:spec)
@@ -26,21 +26,34 @@ task :go_get do
26
26
  sh "go get -u github.com/hayamiz/perfmonger/core/subsystem"
27
27
  sh "go get -u golang.org/x/crypto/ssh/terminal"
28
28
  sh "go get -u github.com/mattn/go-isatty"
29
+ sh "go get -u github.com/nsf/termbox-go"
30
+ sh "go get -u github.com/jroimartin/gocui"
29
31
  end
30
32
 
31
- desc "Run tests of core recorder/player"
33
+ desc "Run tests of golang core library"
32
34
  task :test_core => [:cross_build_core] do
33
35
  Dir.chdir("./core/subsystem") do
36
+ # check coverage
34
37
  sh "go test -v -cover"
35
-
36
- # running static analysis
37
- sh "go vet *.go"
38
38
  end
39
+ end
39
40
 
40
- Dir.chdir("./core") do
41
- sh "go vet *.go"
41
+ desc "Run static-analysis of golang core library"
42
+ task :analyze_core => [:cross_build_core] do
43
+ # running static analysis
44
+ Dir.chdir("./core/subsystem") do
45
+ ["linux", "darwin"].each do |platform|
46
+ puts "* ./core/subsystem"
47
+ sh "go vet perfmonger_#{platform}.go $(ls *.go | grep -v perfmonger_)"
48
+ end
42
49
  end
43
50
 
51
+ Dir["./core", "./core/cmd/*"].each do |dir|
52
+ Dir.chdir(dir) do
53
+ puts "* #{dir}"
54
+ sh "go vet *.go"
55
+ end
56
+ end
44
57
  end
45
58
 
46
59
  desc "Removed generated files"
data/core/Makefile CHANGED
@@ -2,47 +2,54 @@
2
2
  # generated by build.sh
3
3
 
4
4
  GO_DEPS := subsystem/perfmonger_darwin.go subsystem/perfmonger.go subsystem/perfmonger_linux.go subsystem/perfmonger_linux_test.go subsystem/stat.go subsystem/stat_test.go subsystem/usage.go subsystem/usage_test.go utils.go
5
- GO_SRC := utils.go
6
5
 
7
6
  .PHONY: all build clean
8
7
 
9
8
  all: build
10
9
 
11
10
 
12
- ../lib/exec/perfmonger-recorder_linux_amd64: perfmonger-recorder.go $(GO_DEPS)
13
- go build -o $@ perfmonger-recorder.go $(GO_SRC)
11
+ ../lib/exec/perfmonger-recorder_linux_amd64: cmd/perfmonger-recorder/perfmonger-recorder.go $(GO_DEPS)
12
+ cd cmd/perfmonger-recorder && go build -o ../../$@ perfmonger-recorder.go
14
13
 
15
14
 
16
- ../lib/exec/perfmonger-player_linux_amd64: perfmonger-player.go $(GO_DEPS)
17
- go build -o $@ perfmonger-player.go $(GO_SRC)
15
+ ../lib/exec/perfmonger-player_linux_amd64: cmd/perfmonger-player/perfmonger-player.go $(GO_DEPS)
16
+ cd cmd/perfmonger-player && go build -o ../../$@ perfmonger-player.go
18
17
 
19
18
 
20
- ../lib/exec/perfmonger-summarizer_linux_amd64: perfmonger-summarizer.go $(GO_DEPS)
21
- go build -o $@ perfmonger-summarizer.go $(GO_SRC)
19
+ ../lib/exec/perfmonger-viewer_linux_amd64: cmd/perfmonger-viewer/perfmonger-viewer.go $(GO_DEPS)
20
+ cd cmd/perfmonger-viewer && go build -o ../../$@ perfmonger-viewer.go
22
21
 
23
22
 
24
- ../lib/exec/perfmonger-plot-formatter_linux_amd64: perfmonger-plot-formatter.go $(GO_DEPS)
25
- go build -o $@ perfmonger-plot-formatter.go $(GO_SRC)
23
+ ../lib/exec/perfmonger-summarizer_linux_amd64: cmd/perfmonger-summarizer/perfmonger-summarizer.go $(GO_DEPS)
24
+ cd cmd/perfmonger-summarizer && go build -o ../../$@ perfmonger-summarizer.go
26
25
 
27
26
 
28
- ../lib/exec/perfmonger-recorder_darwin_amd64: perfmonger-recorder.go $(GO_DEPS)
29
- go build -o $@ perfmonger-recorder.go $(GO_SRC)
27
+ ../lib/exec/perfmonger-plot-formatter_linux_amd64: cmd/perfmonger-plot-formatter/perfmonger-plot-formatter.go $(GO_DEPS)
28
+ cd cmd/perfmonger-plot-formatter && go build -o ../../$@ perfmonger-plot-formatter.go
30
29
 
31
30
 
32
- ../lib/exec/perfmonger-player_darwin_amd64: perfmonger-player.go $(GO_DEPS)
33
- go build -o $@ perfmonger-player.go $(GO_SRC)
31
+ ../lib/exec/perfmonger-recorder_darwin_amd64: cmd/perfmonger-recorder/perfmonger-recorder.go $(GO_DEPS)
32
+ cd cmd/perfmonger-recorder && go build -o ../../$@ perfmonger-recorder.go
34
33
 
35
34
 
36
- ../lib/exec/perfmonger-summarizer_darwin_amd64: perfmonger-summarizer.go $(GO_DEPS)
37
- go build -o $@ perfmonger-summarizer.go $(GO_SRC)
35
+ ../lib/exec/perfmonger-player_darwin_amd64: cmd/perfmonger-player/perfmonger-player.go $(GO_DEPS)
36
+ cd cmd/perfmonger-player && go build -o ../../$@ perfmonger-player.go
38
37
 
39
38
 
40
- ../lib/exec/perfmonger-plot-formatter_darwin_amd64: perfmonger-plot-formatter.go $(GO_DEPS)
41
- go build -o $@ perfmonger-plot-formatter.go $(GO_SRC)
39
+ ../lib/exec/perfmonger-viewer_darwin_amd64: cmd/perfmonger-viewer/perfmonger-viewer.go $(GO_DEPS)
40
+ cd cmd/perfmonger-viewer && go build -o ../../$@ perfmonger-viewer.go
42
41
 
43
42
 
44
- build: ../lib/exec/perfmonger-recorder_linux_amd64 ../lib/exec/perfmonger-player_linux_amd64 ../lib/exec/perfmonger-summarizer_linux_amd64 ../lib/exec/perfmonger-plot-formatter_linux_amd64 ../lib/exec/perfmonger-recorder_darwin_amd64 ../lib/exec/perfmonger-player_darwin_amd64 ../lib/exec/perfmonger-summarizer_darwin_amd64 ../lib/exec/perfmonger-plot-formatter_darwin_amd64
43
+ ../lib/exec/perfmonger-summarizer_darwin_amd64: cmd/perfmonger-summarizer/perfmonger-summarizer.go $(GO_DEPS)
44
+ cd cmd/perfmonger-summarizer && go build -o ../../$@ perfmonger-summarizer.go
45
+
46
+
47
+ ../lib/exec/perfmonger-plot-formatter_darwin_amd64: cmd/perfmonger-plot-formatter/perfmonger-plot-formatter.go $(GO_DEPS)
48
+ cd cmd/perfmonger-plot-formatter && go build -o ../../$@ perfmonger-plot-formatter.go
49
+
50
+
51
+ build: ../lib/exec/perfmonger-recorder_linux_amd64 ../lib/exec/perfmonger-player_linux_amd64 ../lib/exec/perfmonger-viewer_linux_amd64 ../lib/exec/perfmonger-summarizer_linux_amd64 ../lib/exec/perfmonger-plot-formatter_linux_amd64 ../lib/exec/perfmonger-recorder_darwin_amd64 ../lib/exec/perfmonger-player_darwin_amd64 ../lib/exec/perfmonger-viewer_darwin_amd64 ../lib/exec/perfmonger-summarizer_darwin_amd64 ../lib/exec/perfmonger-plot-formatter_darwin_amd64
45
52
 
46
53
  clean:
47
- rm -f ../lib/exec/perfmonger-recorder_linux_amd64 ../lib/exec/perfmonger-player_linux_amd64 ../lib/exec/perfmonger-summarizer_linux_amd64 ../lib/exec/perfmonger-plot-formatter_linux_amd64 ../lib/exec/perfmonger-recorder_darwin_amd64 ../lib/exec/perfmonger-player_darwin_amd64 ../lib/exec/perfmonger-summarizer_darwin_amd64 ../lib/exec/perfmonger-plot-formatter_darwin_amd64
54
+ rm -f ../lib/exec/perfmonger-recorder_linux_amd64 ../lib/exec/perfmonger-player_linux_amd64 ../lib/exec/perfmonger-viewer_linux_amd64 ../lib/exec/perfmonger-summarizer_linux_amd64 ../lib/exec/perfmonger-plot-formatter_linux_amd64 ../lib/exec/perfmonger-recorder_darwin_amd64 ../lib/exec/perfmonger-player_darwin_amd64 ../lib/exec/perfmonger-viewer_darwin_amd64 ../lib/exec/perfmonger-summarizer_darwin_amd64 ../lib/exec/perfmonger-plot-formatter_darwin_amd64
48
55
 
data/core/build.sh CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
- READLINK=$(type -p greadlink readlink | head -1)
4
- cd $(dirname $($READLINK -f $0))
3
+ cd $(cd $(dirname $0); pwd)
5
4
 
6
5
  if [[ $1 = "-" ]]; then
7
6
  # do self build
@@ -33,7 +32,7 @@ fi
33
32
 
34
33
  set -e
35
34
 
36
- GO_DEPS=$(ls subsystem/*.go; ls utils.go)
35
+ GO_DEPS=$(ls subsystem/*.go utils.go)
37
36
 
38
37
  makefile=`mktemp`
39
38
 
@@ -42,7 +41,6 @@ cat <<EOF > $makefile
42
41
  # generated by build.sh
43
42
 
44
43
  GO_DEPS := $(echo ${GO_DEPS})
45
- GO_SRC := utils.go
46
44
 
47
45
  .PHONY: all build clean
48
46
 
@@ -57,13 +55,13 @@ for idx in $(seq 0 $((${#TARGET[@]}-1))); do
57
55
  export var_GOOS=$1
58
56
  export var_GOARCH=$2
59
57
 
60
- for subcmd in recorder player summarizer plot-formatter; do
58
+ for subcmd in recorder player viewer summarizer plot-formatter; do
61
59
  TARGETS+=(../lib/exec/perfmonger-${subcmd}_${var_GOOS}_${var_GOARCH})
62
60
 
63
61
  cat <<EOF >> $makefile
64
62
 
65
- ../lib/exec/perfmonger-${subcmd}_${var_GOOS}_${var_GOARCH}: perfmonger-${subcmd}.go \$(GO_DEPS)
66
- go build -o \$@ perfmonger-$subcmd.go \$(GO_SRC)
63
+ ../lib/exec/perfmonger-${subcmd}_${var_GOOS}_${var_GOARCH}: cmd/perfmonger-${subcmd}/perfmonger-${subcmd}.go \$(GO_DEPS)
64
+ cd cmd/perfmonger-${subcmd} && go build -o ../../\$@ perfmonger-$subcmd.go
67
65
 
68
66
  EOF
69
67
  done
@@ -9,15 +9,19 @@ import (
9
9
  "fmt"
10
10
  "io"
11
11
  "os"
12
+ "regexp"
12
13
 
13
14
  projson "github.com/hayamiz/go-projson"
15
+ core "github.com/hayamiz/perfmonger/core"
14
16
  ss "github.com/hayamiz/perfmonger/core/subsystem"
15
17
  )
16
18
 
17
19
  type PlayerOption struct {
18
- logfile string
19
- color bool
20
- pretty bool
20
+ logfile string
21
+ color bool
22
+ pretty bool
23
+ disk_only string
24
+ disk_only_regex *regexp.Regexp
21
25
  }
22
26
 
23
27
  var option PlayerOption
@@ -49,10 +53,11 @@ func showInterruptStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cu
49
53
  return nil
50
54
  }
51
55
 
52
- func showDiskStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss.StatRecord) error {
53
- dusage, err := ss.GetDiskUsage(
56
+ func showDiskStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss.StatRecord, disk_only_regex *regexp.Regexp) error {
57
+ dusage, err := ss.GetDiskUsage1(
54
58
  prev_rec.Time, prev_rec.Disk,
55
- cur_rec.Time, cur_rec.Disk)
59
+ cur_rec.Time, cur_rec.Disk,
60
+ option.disk_only_regex)
56
61
  if err != nil {
57
62
  return err
58
63
  }
@@ -80,7 +85,22 @@ func showNetStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec
80
85
  return nil
81
86
  }
82
87
 
83
- func showStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss.StatRecord) error {
88
+ func showMemStat(printer *projson.JsonPrinter, cur_rec *ss.StatRecord) error {
89
+ musage, err := ss.GetMemUsage(cur_rec.Mem)
90
+ if err != nil {
91
+ return err
92
+ }
93
+
94
+ printer.PutKey("mem")
95
+
96
+ musage.WriteJsonTo(printer)
97
+
98
+ return nil
99
+ }
100
+
101
+ func showStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss.StatRecord,
102
+ disk_only_regex *regexp.Regexp) error {
103
+
84
104
  printer.Reset()
85
105
  if option.pretty {
86
106
  printer.SetStyle(projson.SmartStyle)
@@ -88,6 +108,7 @@ func showStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss
88
108
  if option.color {
89
109
  printer.SetColor(true)
90
110
  }
111
+
91
112
  printer.BeginObject()
92
113
  printer.PutKey("time")
93
114
  printer.PutFloatFmt(float64(cur_rec.Time.UnixNano())/1e9, "%.3f")
@@ -108,7 +129,7 @@ func showStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss
108
129
  }
109
130
  }
110
131
  if cur_rec.Disk != nil {
111
- err := showDiskStat(printer, prev_rec, cur_rec)
132
+ err := showDiskStat(printer, prev_rec, cur_rec, disk_only_regex)
112
133
  if err != nil {
113
134
  return err
114
135
  }
@@ -119,6 +140,12 @@ func showStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss
119
140
  return err
120
141
  }
121
142
  }
143
+ if cur_rec.Mem != nil {
144
+ err := showMemStat(printer, cur_rec)
145
+ if err != nil {
146
+ return err
147
+ }
148
+ }
122
149
 
123
150
  printer.FinishObject()
124
151
 
@@ -128,9 +155,25 @@ func showStat(printer *projson.JsonPrinter, prev_rec *ss.StatRecord, cur_rec *ss
128
155
  func parseArgs() {
129
156
  flag.BoolVar(&option.color, "color", false, "Use colored JSON output")
130
157
  flag.BoolVar(&option.pretty, "pretty", false, "Use human readable JSON output")
158
+ flag.StringVar(&option.disk_only, "disk-only", "", "Select disk devices by regex")
131
159
 
132
160
  flag.Parse()
133
161
 
162
+ if len(flag.Args()) < 1 {
163
+ fmt.Fprintln(os.Stderr, "Insufficient argument")
164
+ os.Exit(1)
165
+ }
166
+
167
+ option.disk_only_regex = nil
168
+
169
+ if option.disk_only != "" {
170
+ var err error
171
+ option.disk_only_regex, err = regexp.Compile(option.disk_only)
172
+ if err != nil {
173
+ panic(err)
174
+ }
175
+ }
176
+
134
177
  option.logfile = flag.Arg(0)
135
178
  }
136
179
 
@@ -150,7 +193,7 @@ func main() {
150
193
  in = f
151
194
  defer f.Close()
152
195
  }
153
- input_reader := newPerfmongerLogReader(in)
196
+ input_reader := core.NewPerfmongerLogReader(in)
154
197
  dec := gob.NewDecoder(input_reader)
155
198
 
156
199
  out = bufio.NewWriter(os.Stdout)
@@ -199,7 +242,7 @@ func main() {
199
242
  panic(err)
200
243
  }
201
244
 
202
- err = showStat(printer, prev_rec, cur_rec)
245
+ err = showStat(printer, prev_rec, cur_rec, option.disk_only_regex)
203
246
  if err != nil {
204
247
  printer.Reset()
205
248
  fmt.Fprintln(os.Stderr, "skip by err")
@@ -15,6 +15,7 @@ import (
15
15
  "sort"
16
16
 
17
17
  ss "github.com/hayamiz/perfmonger/core/subsystem"
18
+ "github.com/hayamiz/perfmonger/core"
18
19
  )
19
20
 
20
21
  type CmdOption struct {
@@ -141,7 +142,7 @@ func main() {
141
142
  }
142
143
  defer f.Close()
143
144
 
144
- input_reader := newPerfmongerLogReader(f)
145
+ input_reader := core.NewPerfmongerLogReader(f)
145
146
  dec := gob.NewDecoder(input_reader)
146
147
 
147
148
  var cheader ss.CommonHeader
@@ -36,6 +36,7 @@ type RecorderOption struct {
36
36
  no_intr bool
37
37
  no_disk bool
38
38
  no_net bool
39
+ no_mem bool
39
40
  debug bool
40
41
  listDevices bool
41
42
  player_bin string
@@ -76,6 +77,8 @@ func parseArgs() {
76
77
  false, "Do not record disk usage")
77
78
  flag.BoolVar(&option.no_net, "no-net",
78
79
  false, "Do not record net usage")
80
+ flag.BoolVar(&option.no_mem, "no-mem",
81
+ false, "Do not record memory usage")
79
82
  flag.BoolVar(&option.debug, "debug",
80
83
  false, "Enable debug mode")
81
84
  flag.BoolVar(&option.listDevices, "list-devices",
@@ -340,6 +343,9 @@ func main() {
340
343
  if !option.no_net {
341
344
  ss.ReadNetStat(record)
342
345
  }
346
+ if !option.no_mem {
347
+ ss.ReadMemStat(record)
348
+ }
343
349
 
344
350
  err = enc.Encode(record)
345
351
  if err != nil {
@@ -12,6 +12,7 @@ import (
12
12
  "sort"
13
13
 
14
14
  projson "github.com/hayamiz/go-projson"
15
+ "github.com/hayamiz/perfmonger/core"
15
16
  ss "github.com/hayamiz/perfmonger/core/subsystem"
16
17
  )
17
18
 
@@ -38,6 +39,7 @@ func parseArgs() {
38
39
  flag.Parse()
39
40
 
40
41
  if len(flag.Args()) < 1 {
42
+ fmt.Fprintln(os.Stderr, "Insufficient argument")
41
43
  os.Exit(1)
42
44
  }
43
45
 
@@ -61,7 +63,7 @@ func main() {
61
63
  }
62
64
  defer f.Close()
63
65
 
64
- input_reader := newPerfmongerLogReader(f)
66
+ input_reader := core.NewPerfmongerLogReader(f)
65
67
  dec := gob.NewDecoder(input_reader)
66
68
 
67
69
  err = dec.Decode(&cheader)
@@ -128,7 +130,7 @@ func main() {
128
130
  option.disk_only_regex)
129
131
  }
130
132
 
131
- if fst_record.Disk != nil && lst_record.Disk != nil {
133
+ if fst_record.Net != nil && lst_record.Net != nil {
132
134
  net_usage, err = ss.GetNetUsage(
133
135
  fst_record.Time, fst_record.Net,
134
136
  lst_record.Time, lst_record.Net)