-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GetGraphVisualizationFile function in the entire pipeline of Gapid.
- Loading branch information
1 parent
5e0bcc9
commit ef4bedc
Showing
11 changed files
with
111 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (C) 2018 Google Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"github.com/google/gapid/core/app" | ||
"github.com/google/gapid/core/log" | ||
"io/ioutil" | ||
"os" | ||
) | ||
|
||
type createGraphVisualizationVerb struct{ CreateGraphVisualizationFlags } | ||
|
||
func init() { | ||
verb := &createGraphVisualizationVerb{} | ||
app.AddVerb(&app.Verb{ | ||
Name: "create_graph_visualization", | ||
ShortHelp: "Create graph visualization file from capture", | ||
Action: verb, | ||
}) | ||
} | ||
|
||
func (verb *createGraphVisualizationVerb) Run(ctx context.Context, flags flag.FlagSet) error { | ||
if flags.NArg() != 1 { | ||
app.Usage(ctx, "Exactly one gfx trace file expected, got %d", flags.NArg()) | ||
return nil | ||
} | ||
|
||
client, capture, err := getGapisAndLoadCapture(ctx, verb.Gapis, GapirFlags{}, flags.Arg(0), CaptureFileFlags{}) | ||
if err != nil { | ||
return err | ||
} | ||
defer client.Close() | ||
|
||
log.I(ctx, "Creating graph visualization file from capture id: %s", capture.ID) | ||
|
||
graphVisualization, err := client.GetGraphVisualization(ctx, capture) | ||
if err != nil { | ||
return log.Errf(ctx, err, "ExportCapture(%v)", capture) | ||
} | ||
|
||
filePath := verb.Out | ||
if filePath == "" { | ||
filePath = "graph_visualization.dot" | ||
} | ||
|
||
_, err = os.Stat(filePath) | ||
if os.IsNotExist(err) { | ||
file, err := os.Create(filePath) | ||
if err != nil { | ||
log.Errf(ctx, err, "Creating file (%v)", filePath) | ||
} | ||
defer file.Close() | ||
} | ||
|
||
if err := ioutil.WriteFile(filePath, []byte(graphVisualization), 0666); err != nil { | ||
return log.Errf(ctx, err, "Writing file: %v", filePath) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 15 additions & 3 deletions
18
gapis/resolve/dependencygraph2/graph_visualization/graph_visualization.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters