aboutsummaryrefslogtreecommitdiff
path: root/service/path
diff options
context:
space:
mode:
authorBen Clayton <bclayton@google.com>2015-07-06 13:14:24 +0100
committerBen Clayton <bclayton@google.com>2015-07-06 13:22:58 +0100
commit4e766dd03bbd17c7a271afeb60ac2499a5b43fc4 (patch)
treed02fd977414e64b2afc69b6dc07864c3a67c0961 /service/path
parenta098c7b6f1ce4da1eb282be23cb9417e9ee31b9d (diff)
downloadgpu-4e766dd03bbd17c7a271afeb60ac2499a5b43fc4.tar.gz
Add path.Report for referring to a capture’s report.
Change-Id: I4594d44f0805e9da9e0d5741f3eed5f0f9708afb
Diffstat (limited to 'service/path')
-rw-r--r--service/path/README.md54
-rw-r--r--service/path/atoms.go2
-rw-r--r--service/path/capture.go5
-rw-r--r--service/path/path_binary.go57
-rw-r--r--service/path/report.go45
5 files changed, 161 insertions, 2 deletions
diff --git a/service/path/README.md b/service/path/README.md
index 9f85eb6b4..01e7428d2 100644
--- a/service/path/README.md
+++ b/service/path/README.md
@@ -175,7 +175,7 @@ Atoms is a path that refers to the full list of atoms in a capture.
```go
func (n *Atoms) Base() Path
```
-Base implements the Path interface, returning the path to the capture.
+Base implements the Path interface, returning the path to the atoms.
#### func (*Atoms) Class
@@ -256,6 +256,13 @@ func (c *Capture) Path() string
```
Path implements the Path interface.
+#### func (*Capture) Report
+
+```go
+func (c *Capture) Report() Path
+```
+Report returns the path to the capture's report.
+
#### func (*Capture) String
```go
@@ -420,6 +427,51 @@ Path is the interface for types that represent a reference to a capture, atom
list, single atom, memory, state or sub-object. A path can be passed between
client and server using RPCs in order to describe some data in a capture.
+#### type Report
+
+```go
+type Report struct {
+ binary.Generate
+ Capture *Capture // The path to the capture containing the atoms.
+}
+```
+
+Report is a path that refers to a capture's report.
+
+#### func (*Report) Base
+
+```go
+func (n *Report) Base() Path
+```
+Base implements the Path interface, returning the path to the report.
+
+#### func (*Report) Class
+
+```go
+func (*Report) Class() binary.Class
+```
+
+#### func (*Report) Clone
+
+```go
+func (n *Report) Clone() Path
+```
+Clone implements the Path interface, returning a deep-copy of this path.
+
+#### func (*Report) Path
+
+```go
+func (n *Report) Path() string
+```
+Path implements the Path interface.
+
+#### func (*Report) String
+
+```go
+func (n *Report) String() string
+```
+String returns the string representation of the path.
+
#### type State
```go
diff --git a/service/path/atoms.go b/service/path/atoms.go
index 501cd27de..63d2f820e 100644
--- a/service/path/atoms.go
+++ b/service/path/atoms.go
@@ -34,7 +34,7 @@ func (n *Atoms) Path() string {
return fmt.Sprintf("%v.Atoms", n.Capture)
}
-// Base implements the Path interface, returning the path to the capture.
+// Base implements the Path interface, returning the path to the atoms.
func (n *Atoms) Base() Path {
return n.Capture
}
diff --git a/service/path/capture.go b/service/path/capture.go
index a3d91efc6..b2799cfc8 100644
--- a/service/path/capture.go
+++ b/service/path/capture.go
@@ -48,3 +48,8 @@ func (c *Capture) Clone() Path {
func (c *Capture) Atoms() *Atoms {
return &Atoms{Capture: c}
}
+
+// Report returns the path to the capture's report.
+func (c *Capture) Report() Path {
+ return &Report{Capture: c}
+}
diff --git a/service/path/path_binary.go b/service/path/path_binary.go
index de8127ace..3ea96436d 100644
--- a/service/path/path_binary.go
+++ b/service/path/path_binary.go
@@ -22,6 +22,7 @@ func init() {
Namespace.Add((*Atom)(nil).Class())
Namespace.Add((*Field)(nil).Class())
Namespace.Add((*MapIndex)(nil).Class())
+ Namespace.Add((*Report)(nil).Class())
Namespace.Add((*State)(nil).Class())
}
@@ -32,6 +33,7 @@ var (
binaryIDAtom = binary.ID{0x58, 0x11, 0xbe, 0x6d, 0xfc, 0xe2, 0xe0, 0x12, 0x6c, 0x42, 0x55, 0x2d, 0xf3, 0x5e, 0x11, 0x1a, 0xc1, 0x6b, 0xfe, 0x3b}
binaryIDField = binary.ID{0xd0, 0x6a, 0xce, 0x53, 0xcf, 0xc3, 0x4c, 0x2a, 0x51, 0xa7, 0xaf, 0xf1, 0xb5, 0x91, 0x67, 0xdd, 0xe0, 0x21, 0x7b, 0x02}
binaryIDMapIndex = binary.ID{0xf1, 0xfd, 0x8e, 0x5c, 0x70, 0x49, 0x7f, 0xbd, 0x40, 0xbc, 0x54, 0x04, 0xff, 0x46, 0x76, 0xec, 0x4c, 0x4c, 0xc0, 0x01}
+ binaryIDReport = binary.ID{0xc3, 0x15, 0x30, 0x12, 0xb4, 0xa6, 0x7e, 0x71, 0x3a, 0xa3, 0xec, 0xb5, 0x93, 0x21, 0xf6, 0x2f, 0xd2, 0xf1, 0x4f, 0xa9}
binaryIDState = binary.ID{0xf1, 0xa4, 0x19, 0x51, 0x01, 0xc4, 0xe2, 0x90, 0xc2, 0xca, 0x28, 0x00, 0x17, 0x08, 0x72, 0xb9, 0x46, 0x3a, 0xd1, 0x7b}
)
@@ -420,6 +422,61 @@ var schemaMapIndex = &schema.Class{
},
}
+type binaryClassReport struct{}
+
+func (*Report) Class() binary.Class {
+ return (*binaryClassReport)(nil)
+}
+func doEncodeReport(e binary.Encoder, o *Report) error {
+ if o.Capture != nil {
+ if err := e.Object(o.Capture); err != nil {
+ return err
+ }
+ } else if err := e.Object(nil); err != nil {
+ return err
+ }
+ return nil
+}
+func doDecodeReport(d binary.Decoder, o *Report) error {
+ if obj, err := d.Object(); err != nil {
+ return err
+ } else if obj != nil {
+ o.Capture = obj.(*Capture)
+ } else {
+ o.Capture = nil
+ }
+ return nil
+}
+func doSkipReport(d binary.Decoder) error {
+ if _, err := d.SkipObject(); err != nil {
+ return err
+ }
+ return nil
+}
+func (*binaryClassReport) ID() binary.ID { return binaryIDReport }
+func (*binaryClassReport) New() binary.Object { return &Report{} }
+func (*binaryClassReport) Encode(e binary.Encoder, obj binary.Object) error {
+ return doEncodeReport(e, obj.(*Report))
+}
+func (*binaryClassReport) Decode(d binary.Decoder) (binary.Object, error) {
+ obj := &Report{}
+ return obj, doDecodeReport(d, obj)
+}
+func (*binaryClassReport) DecodeTo(d binary.Decoder, obj binary.Object) error {
+ return doDecodeReport(d, obj.(*Report))
+}
+func (*binaryClassReport) Skip(d binary.Decoder) error { return doSkipReport(d) }
+func (*binaryClassReport) Schema() *schema.Class { return schemaReport }
+
+var schemaReport = &schema.Class{
+ TypeID: binaryIDReport,
+ Package: "path",
+ Name: "Report",
+ Fields: []schema.Field{
+ {Declared: "Capture", Type: &schema.Pointer{Type: &schema.Struct{Name: "Capture", ID: (*Capture)(nil).Class().ID()}}},
+ },
+}
+
type binaryClassState struct{}
func (*State) Class() binary.Class {
diff --git a/service/path/report.go b/service/path/report.go
new file mode 100644
index 000000000..16eba87aa
--- /dev/null
+++ b/service/path/report.go
@@ -0,0 +1,45 @@
+// Copyright (C) 2015 The Android Open Source Project
+//
+// 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 path
+
+import (
+ "fmt"
+
+ "android.googlesource.com/platform/tools/gpu/binary"
+)
+
+// Report is a path that refers to a capture's report.
+type Report struct {
+ binary.Generate
+ Capture *Capture // The path to the capture containing the atoms.
+}
+
+// String returns the string representation of the path.
+func (n *Report) String() string { return n.Path() }
+
+// Path implements the Path interface.
+func (n *Report) Path() string {
+ return fmt.Sprintf("%v.Report", n.Capture)
+}
+
+// Base implements the Path interface, returning the path to the report.
+func (n *Report) Base() Path {
+ return n.Capture
+}
+
+// Clone implements the Path interface, returning a deep-copy of this path.
+func (n *Report) Clone() Path {
+ return &Report{Capture: n.Capture.Clone().(*Capture)}
+}