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

add trace profiling #111

Merged
merged 3 commits into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/GoogleCloudPlatform/container-diff/differs"
pkgutil "github.com/GoogleCloudPlatform/container-diff/pkg/util"
"github.com/golang/glog"
"github.com/pkg/profile"
"github.com/spf13/cobra"
)

Expand All @@ -42,6 +43,9 @@ var analyzeCmd = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
if os.Getenv(containerDiffEnvPrefix) == "1" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this in main.go instead?

defer profile.Start(profile.TraceProfile).Stop()
}
if err := analyzeImage(args[0], strings.Split(types, ",")); err != nil {
glog.Error(err)
os.Exit(1)
Expand Down
4 changes: 4 additions & 0 deletions cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/GoogleCloudPlatform/container-diff/differs"
pkgutil "github.com/GoogleCloudPlatform/container-diff/pkg/util"
"github.com/golang/glog"
"github.com/pkg/profile"
"github.com/spf13/cobra"
)

Expand All @@ -43,6 +44,9 @@ var diffCmd = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
if os.Getenv(containerDiffEnvPrefix) == "1" {
defer profile.Start(profile.TraceProfile).Stop()
}
if err := diffImages(args[0], args[1], strings.Split(types, ",")); err != nil {
glog.Error(err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type validatefxn func(args []string) error
const (
DaemonPrefix = "daemon://"
RemotePrefix = "remote://"

containerDiffEnvPrefix = "CONTAINER_DIFF_ENABLE_PROFILING"
)

var RootCmd = &cobra.Command{
Expand Down
11 changes: 11 additions & 0 deletions vendor/github.com/pkg/profile/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/pkg/profile/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions vendor/github.com/pkg/profile/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions vendor/github.com/pkg/profile/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

220 changes: 220 additions & 0 deletions vendor/github.com/pkg/profile/profile.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/github.com/pkg/profile/trace.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/pkg/profile/trace16.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.