Skip to content

Commit

Permalink
gapit: print capture id when loading a capture (#2556)
Browse files Browse the repository at this point in the history
Also refactor "gapit commands" to use getGapisAndLoadCapture.
  • Loading branch information
paulthomson authored Jan 22, 2019
1 parent f100d3b commit 8f82279
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
19 changes: 4 additions & 15 deletions cmd/gapit/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"flag"
"fmt"
"os"
"path/filepath"

"github.com/google/gapid/core/app"
"github.com/google/gapid/core/event/task"
Expand Down Expand Up @@ -53,28 +52,18 @@ func (verb *commandsVerb) Run(ctx context.Context, flags flag.FlagSet) error {
return nil
}

filepath, err := filepath.Abs(flags.Arg(0))
client, capture, err := getGapisAndLoadCapture(ctx, verb.Gapis, verb.Gapir, flags.Arg(0), verb.CaptureFileFlags)
if err != nil {
return log.Err(ctx, err, "Could not find capture file")
}

client, err := getGapis(ctx, verb.Gapis, verb.Gapir)
if err != nil {
return log.Err(ctx, err, "Failed to connect to the GAPIS server")
return err
}
defer client.Close()

c, err := client.LoadCapture(ctx, filepath)
if err != nil {
return log.Err(ctx, err, "Failed to load the capture file")
}

filter, err := verb.commandFilter(ctx, client, c)
filter, err := verb.commandFilter(ctx, client, capture)
if err != nil {
return log.Err(ctx, err, "Failed to build the CommandFilter")
}

treePath := c.CommandTree(filter)
treePath := capture.CommandTree(filter)
treePath.GroupByApi = verb.GroupByAPI
treePath.GroupByContext = verb.GroupByContext
treePath.GroupByThread = verb.GroupByThread
Expand Down
2 changes: 2 additions & 0 deletions cmd/gapit/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ func getGapisAndLoadCapture(ctx context.Context, gapisFlags GapisFlags, gapirFla
}
}

log.I(ctx, "Loaded capture; id: %s", capture.ID)

return client, capture, nil
}

Expand Down
1 change: 1 addition & 0 deletions cmd/gapit/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ type (
AllowIncompleteFrame bool `help:"_Make a group for incomplete frames"`
Observations ObservationFlags
CommandFilterFlags
CaptureFileFlags
}
ReplaceResourceFlags struct {
Gapis GapisFlags
Expand Down
2 changes: 0 additions & 2 deletions cmd/gapit/screenshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ func (verb *screenshotVerb) Run(ctx context.Context, flags flag.FlagSet) error {
}
defer client.Close()

log.I(ctx, "Getting screenshot from capture id: %s", capture.ID)

device, err := getDevice(ctx, client, capture, verb.Gapir)
if err != nil {
return err
Expand Down

0 comments on commit 8f82279

Please sign in to comment.