Add a few provided includable config files
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 15 Mar 2016 01:14:27 +0000 (21:14 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 18 Mar 2016 21:54:59 +0000 (17:54 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/cli.py
barectf/config.py
barectf/include/lttng-ust-log-levels.yaml [new file with mode: 0644]
barectf/include/stdfloat.yaml [new file with mode: 0644]
barectf/include/stdint.yaml [new file with mode: 0644]
barectf/include/stdmisc.yaml [new file with mode: 0644]
barectf/include/trace-basic.yaml [new file with mode: 0644]
setup.py

index cd84fbe94e252a7c148668769e662ef82837c703..00a1ce9150e40704db1e86dd473c678b642b877f 100644 (file)
@@ -20,6 +20,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
 
+from pkg_resources import resource_filename
 from termcolor import cprint, colored
 import barectf.tsdl182gen
 import barectf.config
@@ -106,6 +107,9 @@ def _parse_args():
     if not os.path.isfile(args.config):
         _perror('"{}" is not an existing file'.format(args.config))
 
+    # append current working directory and provided include directory
+    args.include_dir += [os.getcwd(), resource_filename(__name__, 'include')]
+
     return args
 
 
index 2bca56d65efb2f9228d2ce5195ebf6bc5de8488b..2e3fee549f5bc50ab908ed510f244d00a052840d 100644 (file)
@@ -1170,7 +1170,6 @@ class _YamlConfigParser:
             metadata.Variant: self._create_variant,
         }
         self._include_dirs = include_dirs
-        self._include_dirs.append(os.getcwd())
         self._ignore_include_not_found = ignore_include_not_found
         self._dump_config = dump_config
 
diff --git a/barectf/include/lttng-ust-log-levels.yaml b/barectf/include/lttng-ust-log-levels.yaml
new file mode 100644 (file)
index 0000000..76d2544
--- /dev/null
@@ -0,0 +1,23 @@
+# Include this in the metadata object to have access to the LTTng-UST
+# log level values by name.
+#
+# Note that the values from 0 to 7 are compatible with syslog log
+# levels, although the debug severity in syslog is named DEBUG_SYSTEM
+# here.
+
+$log-levels:
+  EMERG: 0
+  ALERT: 1
+  CRIT: 2
+  ERR: 3
+  WARNING: 4
+  NOTICE: 5
+  INFO: 6
+  DEBUG_SYSTEM: 7
+  DEBUG_PROGRAM: 8
+  DEBUG_PROCESS: 9
+  DEBUG_MODULE: 10
+  DEBUG_UNIT: 11
+  DEBUG_FUNCTION: 12
+  DEBUG_LINE: 13
+  DEBUG: 14
diff --git a/barectf/include/stdfloat.yaml b/barectf/include/stdfloat.yaml
new file mode 100644 (file)
index 0000000..dfd2180
--- /dev/null
@@ -0,0 +1,19 @@
+# Include this in the metadata object of your configuration to have
+# access to basic floating point number type aliases.
+
+type-aliases:
+  # IEEE 754-2008 binary32 (single-precision)
+  float:
+    class: floating-point
+    size:
+      exp: 8
+      mant: 24
+    align: 32
+
+  # IEEE 754-2008 binary64 (double-precision)
+  double:
+    class: floating-point
+    size:
+      exp: 11
+      mant: 53
+    align: 64
diff --git a/barectf/include/stdint.yaml b/barectf/include/stdint.yaml
new file mode 100644 (file)
index 0000000..2e94bcf
--- /dev/null
@@ -0,0 +1,126 @@
+# Include this in the metadata object of your configuratio
+# access to basic integer type aliases.
+
+type-aliases:
+  # 8-bit unsigned integer, 8-bit aligned
+  uint8:
+    class: int
+    size: 8
+    align: 8
+  byte: uint8
+
+  # 8-bit signed integer, 8-bit aligned
+  int8:
+    $inherit: uint8
+    signed: true
+
+  # 16-bit unsigned integer, 16-bit aligned
+  uint16:
+    class: int
+    size: 16
+    align: 16
+  word: uint16
+
+  # 16-bit signed integer, 16-bit aligned
+  int16:
+    $inherit: uint8
+    signed: true
+
+  # 32-bit unsigned integer, 32-bit aligned
+  uint32:
+    class: int
+    size: 32
+    align: 32
+  dword: uint32
+
+  # 32-bit signed integer, 32-bit aligned
+  int32:
+    $inherit: uint8
+    signed: true
+
+  # 64-bit unsigned integer, 64-bit aligned
+  uint64:
+    class: int
+    size: 64
+    align: 64
+
+  # 64-bit signed integer, 64-bit aligned
+  int64:
+    $inherit: uint8
+    signed: true
+
+  # byte-packed 8-bit unsigned integer
+  byte-packed-uint8: uint8
+
+  # byte-packed 8-bit signed integer
+  byte-packed-int8: int8
+
+  # byte-packed 16-bit unsigned integer
+  byte-packed-uint16:
+    $inherit: uint16
+    align: 8
+
+  # byte-packed 16-bit signed integer
+  byte-packed-int16:
+    $inherit: int16
+    align: 8
+
+  # byte-packed 32-bit unsigned integer
+  byte-packed-uint32:
+    $inherit: uint32
+    align: 8
+
+  # byte-packed 32-bit signed integer
+  byte-packed-int32:
+    $inherit: int32
+    align: 8
+
+  # byte-packed 64-bit unsigned integer
+  byte-packed-uint64:
+    $inherit: uint64
+    align: 8
+
+  # byte-packed 64-bit signed integer
+  byte-packed-int64:
+    $inherit: int64
+    align: 8
+
+  # byte-packed 8-bit unsigned integer
+  bit-packed-uint8:
+    $inherit: uint8
+    align: 1
+
+  # bit-packed 8-bit signed integer
+  bit-packed-int8:
+    $inherit: int8
+    align: 1
+
+  # bit-packed 16-bit unsigned integer
+  bit-packed-uint16:
+    $inherit: uint16
+    align: 1
+
+  # bit-packed 16-bit signed integer
+  bit-packed-int16:
+    $inherit: int16
+    align: 1
+
+  # bit-packed 32-bit unsigned integer
+  bit-packed-uint32:
+    $inherit: uint32
+    align: 1
+
+  # bit-packed 32-bit signed integer
+  bit-packed-int32:
+    $inherit: int32
+    align: 1
+
+  # bit-packed 64-bit unsigned integer
+  bit-packed-uint64:
+    $inherit: uint64
+    align: 1
+
+  # bit-packed 64-bit signed integer
+  bit-packed-int64:
+    $inherit: int64
+    align: 1
diff --git a/barectf/include/stdmisc.yaml b/barectf/include/stdmisc.yaml
new file mode 100644 (file)
index 0000000..4177aa1
--- /dev/null
@@ -0,0 +1,21 @@
+# Include this in the metadata object of your configuration to have
+# access to various useful type aliases.
+
+type-aliases:
+  # UUID array
+  uuid:
+    class: array
+    length: 16
+    element-type:
+      class: int
+      size: 8
+
+  # CTF magic number type
+  ctf-magic:
+    class: int
+    size: 32
+    align: 32
+
+  # a simple string
+  string:
+    class: string
diff --git a/barectf/include/trace-basic.yaml b/barectf/include/trace-basic.yaml
new file mode 100644 (file)
index 0000000..20c2a2e
--- /dev/null
@@ -0,0 +1,24 @@
+# Include this in the trace object of your configuration to get a
+# default, basic trace object with a little-endian byte order. The
+# packet header type contains the 32-bit magic number, followed by the
+# UUID, followed by an 8-bit stream ID. The trace's UUID is
+# automatically generated by barectf.
+
+byte-order: le
+uuid: auto
+packet-header-type:
+  class: struct
+  fields:
+    magic:
+      class: int
+      size: 32
+      align: 32
+    uuid:
+      class: array
+      length: 16
+      element-type:
+        class: int
+        size: 8
+    stream_id:
+      class: int
+      size: 8
index 086793cb1f9c358ff0c7ba9f27369d9037e3c179..6fa78949aadd6bf6cd49964bde3e2981d665f779 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -52,6 +52,11 @@ setup(name='barectf',
       packages=[
           'barectf',
       ],
+      package_data={
+          'barectf': [
+              'include/*.yaml',
+          ],
+      },
       install_requires=[
           'termcolor',
           'pyyaml',
This page took 0.028256 seconds and 4 git commands to generate.