Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit d584250

Browse files
committed
add trace profiling
1 parent aab714c commit d584250

File tree

11 files changed

+343
-0
lines changed

11 files changed

+343
-0
lines changed

Godeps/Godeps.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/analyze.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/GoogleCloudPlatform/container-diff/differs"
2626
pkgutil "github.com/GoogleCloudPlatform/container-diff/pkg/util"
2727
"github.com/golang/glog"
28+
"github.com/pkg/profile"
2829
"github.com/spf13/cobra"
2930
)
3031

@@ -42,6 +43,9 @@ var analyzeCmd = &cobra.Command{
4243
return nil
4344
},
4445
Run: func(cmd *cobra.Command, args []string) {
46+
if os.Getenv(containerDiffEnvPrefix) == "1" {
47+
defer profile.Start(profile.TraceProfile).Stop()
48+
}
4549
if err := analyzeImage(args[0], strings.Split(types, ",")); err != nil {
4650
glog.Error(err)
4751
os.Exit(1)

cmd/diff.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/GoogleCloudPlatform/container-diff/differs"
2727
pkgutil "github.com/GoogleCloudPlatform/container-diff/pkg/util"
2828
"github.com/golang/glog"
29+
"github.com/pkg/profile"
2930
"github.com/spf13/cobra"
3031
)
3132

@@ -43,6 +44,9 @@ var diffCmd = &cobra.Command{
4344
return nil
4445
},
4546
Run: func(cmd *cobra.Command, args []string) {
47+
if os.Getenv(containerDiffEnvPrefix) == "1" {
48+
defer profile.Start(profile.TraceProfile).Stop()
49+
}
4650
if err := diffImages(args[0], args[1], strings.Split(types, ",")); err != nil {
4751
glog.Error(err)
4852
os.Exit(1)

cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ type validatefxn func(args []string) error
4141
const (
4242
DaemonPrefix = "daemon://"
4343
RemotePrefix = "remote://"
44+
45+
containerDiffEnvPrefix = "CONTAINER_DIFF_ENABLE_PROFILING"
4446
)
4547

4648
var RootCmd = &cobra.Command{

vendor/github.com/pkg/profile/.travis.yml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/pkg/profile/AUTHORS

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/pkg/profile/LICENSE

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/pkg/profile/README.md

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/pkg/profile/profile.go

Lines changed: 220 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/pkg/profile/trace.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/pkg/profile/trace16.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)