diff options
author | Kevin Hilman <khilman@linaro.org> | 2014-06-24 16:16:32 -0700 |
---|---|---|
committer | Vincent Guittot <vincent.guittot@linaro.org> | 2014-08-01 15:30:40 +0200 |
commit | 50491abfea43ad2d3722031e731a81c09995b5a5 (patch) | |
tree | 426c002885b7e9484993616e5386b867556154ca /doc | |
parent | 0b916c04797503ecea8d9cdb13928885e1b6387c (diff) |
KJH: test JSON merge tool
Example of how to combine JSON tests:
./merge.py -o combined.json global.json resources.json thread0.json thread1.json thread2.json thread3.json
Diffstat (limited to 'doc')
-rw-r--r-- | doc/global.json | 12 | ||||
-rwxr-xr-x | doc/merge.py | 42 | ||||
-rw-r--r-- | doc/resources.json | 11 | ||||
-rw-r--r-- | doc/thread0.json | 15 | ||||
-rw-r--r-- | doc/thread1.json | 14 | ||||
-rw-r--r-- | doc/thread2.json | 13 | ||||
-rw-r--r-- | doc/thread3.json | 13 |
7 files changed, 120 insertions, 0 deletions
diff --git a/doc/global.json b/doc/global.json new file mode 100644 index 0000000..58dbfb3 --- /dev/null +++ b/doc/global.json @@ -0,0 +1,12 @@ +{ + "global" : { + "default_policy" : "SCHED_OTHER", + "duration" : 5, + "ftrace" : true, + "gnuplot" : true, + "logdir" : "/tmp/", + "log_basename" : "rt-app", + "lock_pages" : true, + "frag" : 1 + } +} diff --git a/doc/merge.py b/doc/merge.py new file mode 100755 index 0000000..a95c7a2 --- /dev/null +++ b/doc/merge.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import os +import sys +import getopt +import json + +outfile = "merged.json" + +try: + opts, args = getopt.getopt(sys.argv[1:], "o:") + +except getopt.GetoptError as err: + print str(err) # will print something like "option -a not recognized" + sys.exit(2) +for o, a in opts: + if o == "-o": + outfile = a + +merged = dict() +for f in args: + if not os.path.exists(f): + print "WARN: %s does not exist", f + + fp = open(f, "r") + d = json.load(fp) + fp.close() + + for key in d: + print key, + if merged.has_key(key): + print "WARNING: merged already has key", key + merged[key].update(d[key]) + else: + merged[key] = d[key] + + print merged + print + +fp = open(outfile, "w") +json.dump(merged, fp, indent=4, sort_keys=True) +fp.close() diff --git a/doc/resources.json b/doc/resources.json new file mode 100644 index 0000000..11142c9 --- /dev/null +++ b/doc/resources.json @@ -0,0 +1,11 @@ +{ + "resources" : { + "m0" : { "type" : "mutex" }, + "sync_mutex" : { "type" : "mutex" }, + "wait" : { "type" : "wait" }, + "trig" : { "type" : "signal", "target" : "wait" }, + "m1" : { "type" : "mutex" }, + "wake" : { "type" : "wait" }, + "broad" : { "type" : "broadcast", "target" : "wake" } + } +} diff --git a/doc/thread0.json b/doc/thread0.json new file mode 100644 index 0000000..e845e18 --- /dev/null +++ b/doc/thread0.json @@ -0,0 +1,15 @@ +{ + "tasks" : { + "thread0" : { + "exec" : 5000, + "period" : 5000, + "deadline" : 5000, + "lock_order" : ["wait", "m0", "broad"], + "resources" : { + "m0" : { "duration" : 1000 }, + "wait" : { "duration" : 0, "access": ["sync_mutex"] }, + "broad" : { "duration" : 0, "access": ["m1"] } + } + } + } +} diff --git a/doc/thread1.json b/doc/thread1.json new file mode 100644 index 0000000..37fea77 --- /dev/null +++ b/doc/thread1.json @@ -0,0 +1,14 @@ +{ + "tasks" : { + "thread1" : { + "exec" : 1000, + "period" : 10000, + "deadline" : 8000, + "lock_order" : ["m0", "trig"], + "resources" : { + "m0" : { "duration" : 500 }, + "trig" : { "duration" : 0, "access": ["sync_mutex"] } + } + } + } +} diff --git a/doc/thread2.json b/doc/thread2.json new file mode 100644 index 0000000..024cefa --- /dev/null +++ b/doc/thread2.json @@ -0,0 +1,13 @@ +{ + "tasks" : { + "thread2" : { + "exec" : 1000, + "period" : 1000, + "deadline" : 1000, + "lock_order" : ["wake"], + "resources" : { + "wake" : { "duration" : 0, "access": ["m1"] } + } + } + } +} diff --git a/doc/thread3.json b/doc/thread3.json new file mode 100644 index 0000000..98a07eb --- /dev/null +++ b/doc/thread3.json @@ -0,0 +1,13 @@ +{ + "tasks" : { + "thread3" : { + "exec" : 1000, + "period" : 1000, + "deadline" : 1000, + "lock_order" : ["wake"], + "resources" : { + "wake" : { "duration" : 0, "access": ["m1"] } + } + } + } +} |