-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove pseudo-commands for mid-execution capture. #1527
Changes from all commits
3d9a452
eb454ea
22a0c10
b20aa2f
1db158a
9617416
c988c36
a996347
eb8c499
cece40b
d69172a
bbd73ba
1016393
6f4306c
5ca50b2
bcd8419
874b6cd
3b5c2c9
c163ae4
46f17e7
1ed65ca
ba0ad0c
21567af
d05cea8
cb75983
b279130
ba00f00
60e913e
6137e46
b2d72ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (C) 2017 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. | ||
|
||
go_install() | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (C) 2017 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. | ||
|
||
# Generated globbing source file | ||
# This file will be automatically regenerated if deleted, do not edit by hand. | ||
# If you add a new file to the directory, just delete this file, run any cmake | ||
# build and the file will be recreated, check in the new version. | ||
|
||
set(files | ||
main.go | ||
) | ||
set(dirs | ||
|
||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright (C) 2017 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. | ||
|
||
// The gapid command launches the GAPID UI. It looks for the JVM (bundled or | ||
// from the system), the GAPIC JAR (bundled or from the build output) and | ||
// launches GAPIC with the correct JVM flags and environment variables. | ||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/google/gapid/core/app" | ||
log "github.com/google/gapid/core/log" | ||
_ "github.com/google/gapid/gapis/api/gles" | ||
_ "github.com/google/gapid/gapis/api/gvr" | ||
_ "github.com/google/gapid/gapis/api/vulkan" | ||
"github.com/google/gapid/gapis/capture" | ||
"github.com/google/gapid/gapis/database" | ||
"github.com/google/gapid/gapis/resolve/initialcmds" | ||
) | ||
|
||
var ( | ||
path = flag.String("file", "capture.gfxtrace", "The capture file to linearize") | ||
output = flag.String("out", "capture.linear.gfxtrace", "The output file") | ||
) | ||
|
||
func main() { | ||
app.ShortHelp = "linearize_trace converts a mid-execution capture to a linear trace" | ||
app.Name = "linearize_trace" | ||
app.Run(run) | ||
} | ||
|
||
func run(ctx context.Context) error { | ||
|
||
ctx = database.Put(ctx, database.NewInMemory(ctx)) | ||
|
||
name := filepath.Base(*path) | ||
in, err := ioutil.ReadFile(*path) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
p, err := capture.Import(ctx, name, in) | ||
if err != nil { | ||
return err | ||
} | ||
// Ensure the capture can be read by resolving it now. | ||
capt, err := capture.ResolveFromPath(ctx, p) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
initialCmds, _, err := initialcmds.InitialCommands(ctx, p) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
log.I(ctx, "Generated %v initial commands", len(initialCmds)) | ||
|
||
capt.Commands = append(initialCmds, capt.Commands...) | ||
capt.InitialState = nil | ||
|
||
f, err := os.OpenFile(*output, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) | ||
if err != nil { | ||
return err | ||
} | ||
defer f.Close() | ||
|
||
if err = capt.Export(ctx, f); err != nil { | ||
return err | ||
} | ||
log.I(ctx, "Capture written to: %v", *output) | ||
|
||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,10 @@ inline Slice<T>::Slice() : mBase(nullptr), mCount(0) {} | |
template<typename T> | ||
inline Slice<T>::Slice(T* base, uint64_t count, const std::shared_ptr<Pool>& pool) | ||
: mBase(base), mCount(count), mPool(pool) { | ||
GAPID_ASSERT(mBase != nullptr || count == 0 /* Slice: null pointer */); | ||
|
||
if (!mPool || !mPool->is_virtual()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC mPool is nullptr, if this is the application pool. I might be wrong, but I think that is the reasoning for this logic. |
||
GAPID_ASSERT(mBase != nullptr || count == 0 /* Slice: null pointer */); | ||
} | ||
} | ||
|
||
template<typename T> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ | |
#include <unordered_map> | ||
|
||
namespace gapii { | ||
const uint8_t kAllAPIs = 0xFF; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably we can change the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I would prefer to leave this for a future CL. |
||
|
||
class SpyBase { | ||
public: | ||
|
@@ -89,7 +90,7 @@ class SpyBase { | |
void set_suspended(bool suspended) { mIsSuspended = suspended; } | ||
|
||
bool should_trace(uint8_t api) { | ||
return !is_suspended() && (mWatchedApis & (1 << api)) != 0; | ||
return !is_suspended() && (api == kAllAPIs || (mWatchedApis & (1 << api)) != 0); | ||
} | ||
void set_valid_apis(uint32_t apis) { mWatchedApis = apis; } | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be
go_installl(DESTINATION ${TARGET_INSTALL_PATH})
?