This set adds a script to tune parameters in JSON files and fixes all trailing commas in example JSON files.
changes v1 to v2: merge example6.json into example2.json
pi-cheng.chen (2): Add a script to tune parameters in json file. Fix all trailing commas in /doc/examples/*
doc/examples/browser.json | 36 ++++++------ doc/examples/example1.json | 6 +- doc/examples/example2.json | 7 ++- doc/examples/example3.json | 8 +-- doc/examples/example4.json | 8 +-- doc/examples/mp3.json | 16 +++--- doc/tune_json.py | 138 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 179 insertions(+), 40 deletions(-) create mode 100755 doc/tune_json.py
This scripts strips all comments in the input JSON file, modifies the parameters according to commnad line arguments, and write the content to a new JSON file.
Signed-off-by: Pi-Cheng Chen pi-cheng.chen@linaro.org --- doc/tune_json.py | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100755 doc/tune_json.py
diff --git a/doc/tune_json.py b/doc/tune_json.py new file mode 100755 index 0000000..36746ff --- /dev/null +++ b/doc/tune_json.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python + +import collections +import argparse +import shutil +import os +import sys +import json +import re + + +def find_dict_by_key(doc, key): + if key in doc and type(doc[key]) is collections.OrderedDict: + return doc[key] + + for k in doc: + if type(doc[k]) is collections.OrderedDict: + return find_dict_by_key(doc[k], key) + + +def dict_find_and_replace_value(dic, key, val): + for k in dic: + if type(dic[k]) is collections.OrderedDict: + dict_find_and_replace_value(dic[k], key, val) + if k == key: + dic[k] = val + + +def dict_of_loading(dic): + if not 'run' in dic: + return False, None + + for k in dic: + if 'timer' in k and 'period' in dic[k]: + return True, k + else: + return False, None + + +def calculate_and_update_loading(dic, loading): + of_loading, timer_id = dict_of_loading(dic) + + if of_loading: + period = dic[timer_id]['period'] + run = period * loading / 100 + dic['run'] = run + + for k in dic: + if type(dic[k]) is collections.OrderedDict: + calculate_and_update_loading(dic[k], loading) + + +# strip comments in json file and load the file as a dict +def load_json_file(filename): + try: + f = open(filename, 'r') + except: + print 'ERROR: Unable to open %s' %filename + sys.exit(2) + + comment_re = re.compile( + '(^)?[^\S\n]*/(?:*(.*?)*/[^\S\n]*|/[^\n]*)($)?', + re.DOTALL | re.MULTILINE) + + content = ''.join(f.readlines()) + + match = comment_re.search(content) + while match: + content = content[:match.start()] + content[match.end():] + match = comment_re.search(content) + + return json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(content) + + +def dump_json_file(doc, filename): + try: + fo = open(filename, 'w+') + except: + print 'ERROR: Unable to open %s' %filename + sys.exit(2) + + json.dump(doc, fo, indent=4, sort_keys=False) + fo.close() + + +if __name__ == '__main__': + tmp = 'tmp.json' + + parser = argparse.ArgumentParser() + + parser.add_argument('-f', '--file', dest='infile', default='', help='input json filename') + parser.add_argument('-o', '--out', dest='outfile', default='workload.json', help='output json filename'); + parser.add_argument('--instance', default=0, type=int, help='number of thread instance') + parser.add_argument('--period', default=0, type=int, help='period of each thread/phase (ms)') + parser.add_argument('--run', default=0, type=int, help='run time of each thread/phase (ms)') + parser.add_argument('--sleep', default=0, type=int, help='sleep time of each thread/phase (ms)') + parser.add_argument('--loop', default=0,type=int, help='loop count of each thread/phase (-1 as infinite loop)') + parser.add_argument('--loading', default=0, type=int, help='loading of each thread (%%)') + parser.add_argument('--key', type=str, help='the key id of thread/phase in which the parameters will be changed') + + args = parser.parse_args() + + if not os.path.isfile(args.infile): + print 'ERROR: input file %s does not exist\n' %args.infile + parser.print_help() + sys.exit(2) + + shutil.copyfile(args.infile, tmp) + + doc = target = load_json_file(tmp) + + if args.key: + target = find_dict_by_key(doc, args.key) + if not target: + print 'ERROR: key id %s is not found' %args.key + sys.exit(2) + + if args.instance > 0: + dict_find_and_replace_value(target, 'instance', args.instance) + + if args.period > 0: + dict_find_and_replace_value(target, 'period', args.period * 1000) + + if args.run > 0: + dict_find_and_replace_value(target, 'run', args.run * 1000) + + if args.sleep > 0: + dict_find_and_replace_value(target, 'sleep', args.sleep * 1000) + + if args.loop > 0 or args.loop == -1: + dict_find_and_replace_value(target, 'loop', args.loop) + + if args.loading > 0: + calculate_and_update_loading(target, args.loading); + + dump_json_file(doc, tmp) + + os.rename(tmp, args.outfile)
On 19 November 2014 at 14:14, pi-cheng.chen pi-cheng.chen@linaro.org wrote:
This scripts strips all comments in the input JSON file, modifies the parameters according to commnad line arguments, and write the content to a new JSON file.
Signed-off-by: Pi-Cheng Chen pi-cheng.chen@linaro.org
doc/tune_json.py | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100755 doc/tune_json.py
diff --git a/doc/tune_json.py b/doc/tune_json.py new file mode 100755 index 0000000..36746ff --- /dev/null +++ b/doc/tune_json.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python
+import collections +import argparse +import shutil +import os +import sys +import json +import re
+def find_dict_by_key(doc, key):
- if key in doc and type(doc[key]) is collections.OrderedDict:
return doc[key]
- for k in doc:
if type(doc[k]) is collections.OrderedDict:
return find_dict_by_key(doc[k], key)
+def dict_find_and_replace_value(dic, key, val):
- for k in dic:
if type(dic[k]) is collections.OrderedDict:
dict_find_and_replace_value(dic[k], key, val)
if k == key:
dic[k] = val
+def dict_of_loading(dic):
- if not 'run' in dic:
return False, None
- for k in dic:
if 'timer' in k and 'period' in dic[k]:
return True, k
- else:
return False, None
+def calculate_and_update_loading(dic, loading):
- of_loading, timer_id = dict_of_loading(dic)
- if of_loading:
period = dic[timer_id]['period']
run = period * loading / 100
dic['run'] = run
- for k in dic:
if type(dic[k]) is collections.OrderedDict:
calculate_and_update_loading(dic[k], loading)
+# strip comments in json file and load the file as a dict +def load_json_file(filename):
- try:
f = open(filename, 'r')
- except:
print 'ERROR: Unable to open %s' %filename
sys.exit(2)
- comment_re = re.compile(
'(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?',
re.DOTALL | re.MULTILINE)
- content = ''.join(f.readlines())
- match = comment_re.search(content)
- while match:
content = content[:match.start()] + content[match.end():]
match = comment_re.search(content)
- return json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(content)
+def dump_json_file(doc, filename):
- try:
fo = open(filename, 'w+')
- except:
print 'ERROR: Unable to open %s' %filename
sys.exit(2)
- json.dump(doc, fo, indent=4, sort_keys=False)
- fo.close()
+if __name__ == '__main__':
- tmp = 'tmp.json'
your tmp file should be a bit more unique than tmp.json. I can imagine that the user of tune_json.py already has a tmp.json in the dir which will be overwritten by the script. You could add something like the current time stamp in the temporary file name to reduce the probability to overwrite a user's file
Otherwise it looks good for me
- parser = argparse.ArgumentParser()
- parser.add_argument('-f', '--file', dest='infile', default='', help='input json filename')
- parser.add_argument('-o', '--out', dest='outfile', default='workload.json', help='output json filename');
- parser.add_argument('--instance', default=0, type=int, help='number of thread instance')
- parser.add_argument('--period', default=0, type=int, help='period of each thread/phase (ms)')
- parser.add_argument('--run', default=0, type=int, help='run time of each thread/phase (ms)')
- parser.add_argument('--sleep', default=0, type=int, help='sleep time of each thread/phase (ms)')
- parser.add_argument('--loop', default=0,type=int, help='loop count of each thread/phase (-1 as infinite loop)')
- parser.add_argument('--loading', default=0, type=int, help='loading of each thread (%%)')
- parser.add_argument('--key', type=str, help='the key id of thread/phase in which the parameters will be changed')
- args = parser.parse_args()
- if not os.path.isfile(args.infile):
print 'ERROR: input file %s does not exist\n' %args.infile
parser.print_help()
sys.exit(2)
- shutil.copyfile(args.infile, tmp)
- doc = target = load_json_file(tmp)
- if args.key:
target = find_dict_by_key(doc, args.key)
if not target:
print 'ERROR: key id %s is not found' %args.key
sys.exit(2)
- if args.instance > 0:
dict_find_and_replace_value(target, 'instance', args.instance)
- if args.period > 0:
dict_find_and_replace_value(target, 'period', args.period * 1000)
- if args.run > 0:
dict_find_and_replace_value(target, 'run', args.run * 1000)
- if args.sleep > 0:
dict_find_and_replace_value(target, 'sleep', args.sleep * 1000)
- if args.loop > 0 or args.loop == -1:
dict_find_and_replace_value(target, 'loop', args.loop)
- if args.loading > 0:
calculate_and_update_loading(target, args.loading);
- dump_json_file(doc, tmp)
- os.rename(tmp, args.outfile)
-- 1.9.1
On Thu, Mar 5, 2015 at 3:49 PM, Vincent Guittot vincent.guittot@linaro.org wrote:
On 19 November 2014 at 14:14, pi-cheng.chen pi-cheng.chen@linaro.org wrote:
This scripts strips all comments in the input JSON file, modifies the parameters according to commnad line arguments, and write the content to a new JSON file.
Signed-off-by: Pi-Cheng Chen pi-cheng.chen@linaro.org
doc/tune_json.py | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100755 doc/tune_json.py
diff --git a/doc/tune_json.py b/doc/tune_json.py new file mode 100755 index 0000000..36746ff --- /dev/null +++ b/doc/tune_json.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python
+import collections +import argparse +import shutil +import os +import sys +import json +import re
+def find_dict_by_key(doc, key):
- if key in doc and type(doc[key]) is collections.OrderedDict:
return doc[key]
- for k in doc:
if type(doc[k]) is collections.OrderedDict:
return find_dict_by_key(doc[k], key)
+def dict_find_and_replace_value(dic, key, val):
- for k in dic:
if type(dic[k]) is collections.OrderedDict:
dict_find_and_replace_value(dic[k], key, val)
if k == key:
dic[k] = val
+def dict_of_loading(dic):
- if not 'run' in dic:
return False, None
- for k in dic:
if 'timer' in k and 'period' in dic[k]:
return True, k
- else:
return False, None
+def calculate_and_update_loading(dic, loading):
- of_loading, timer_id = dict_of_loading(dic)
- if of_loading:
period = dic[timer_id]['period']
run = period * loading / 100
dic['run'] = run
- for k in dic:
if type(dic[k]) is collections.OrderedDict:
calculate_and_update_loading(dic[k], loading)
+# strip comments in json file and load the file as a dict +def load_json_file(filename):
- try:
f = open(filename, 'r')
- except:
print 'ERROR: Unable to open %s' %filename
sys.exit(2)
- comment_re = re.compile(
'(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?',
re.DOTALL | re.MULTILINE)
- content = ''.join(f.readlines())
- match = comment_re.search(content)
- while match:
content = content[:match.start()] + content[match.end():]
match = comment_re.search(content)
- return json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(content)
+def dump_json_file(doc, filename):
- try:
fo = open(filename, 'w+')
- except:
print 'ERROR: Unable to open %s' %filename
sys.exit(2)
- json.dump(doc, fo, indent=4, sort_keys=False)
- fo.close()
+if __name__ == '__main__':
- tmp = 'tmp.json'
your tmp file should be a bit more unique than tmp.json. I can imagine that the user of tune_json.py already has a tmp.json in the dir which will be overwritten by the script. You could add something like the current time stamp in the temporary file name to reduce the probability to overwrite a user's file
Or actually use the python standard library functions to generate unique temporary files: https://docs.python.org/2/library/tempfile.html
If you care about referencing the file externally, NamedTemporaryFile might be the right method to use.
On Thu, Mar 5, 2015 at 7:20 PM, Amit Kucheria amit.kucheria@linaro.org wrote:
On Thu, Mar 5, 2015 at 3:49 PM, Vincent Guittot vincent.guittot@linaro.org wrote:
On 19 November 2014 at 14:14, pi-cheng.chen pi-cheng.chen@linaro.org wrote:
+if __name__ == '__main__':
- tmp = 'tmp.json'
your tmp file should be a bit more unique than tmp.json. I can imagine that the user of tune_json.py already has a tmp.json in the dir which will be overwritten by the script. You could add something like the current time stamp in the temporary file name to reduce the probability to overwrite a user's file
Or actually use the python standard library functions to generate unique temporary files: https://docs.python.org/2/library/tempfile.html
If you care about referencing the file externally, NamedTemporaryFile might be the right method to use.
Hi Vincent & Amit,
Thanks for reviewing. I will fix the temporary file naming.
Best Regards, Pi-Cheng
Add key "instance" in example2.json so that the file is flexible to generate workload with multiple small tasks.
Fix all trailing commas in /doc/examples/* so that those JSON file could be tuned by tune_json.py script. A trailing comma in mp3.json needs to be removed manually since it's added by workgen script when adding suspend key.
Signed-off-by: Pi-Cheng Chen pi-cheng.chen@linaro.org --- doc/examples/browser.json | 36 ++++++++++++++++++------------------ doc/examples/example1.json | 6 +++--- doc/examples/example2.json | 7 ++++--- doc/examples/example3.json | 8 ++++---- doc/examples/example4.json | 8 ++++---- doc/examples/mp3.json | 16 ++++++++-------- 6 files changed, 41 insertions(+), 40 deletions(-)
diff --git a/doc/examples/browser.json b/doc/examples/browser.json index a5b4dee..b1436c6 100644 --- a/doc/examples/browser.json +++ b/doc/examples/browser.json @@ -9,57 +9,57 @@ "run" : 15000, "resume" : "Browser", "run" : 7000, - "sleep" : 8000, + "sleep" : 8000 }, "render1" : { "loop" : 50, "resume" : "BrowserSub", - "run" : 3000, + "run" : 3000 }, "render2" : { "loop" : 1, "suspend" : "Browser", "run" : 10000, "resume" : "Browser", - "run" : 5000, + "run" : 5000 }, "render3" : { "loop" : 20, "resume" : "BrowserSub", - "run" : 3000, + "run" : 3000 }, "stop" : { "loop" : 1, "run" : 2000, "sleep" : 200000, "suspend" : "Browser", - "sleep" : 600000, + "sleep" : 600000 }, "scroll" : { "loop" : 4, "resume" : "Browser", "suspend" : "BrowserNext", - "run" : 1000, + "run" : 1000 }, "stop2" : { "loop" : 1, "suspend" : "Browser", "run" : 200, - "sleep" : 800000, - }, + "sleep" : 800000 + } } }, "BrowserSub1" : { "priority" : -6, "loop" : -1, "suspend" : "BrowserSub", - "run" : 100, + "run" : 100 }, "BrowserSub2" : { "priority" : -6, "loop" : -1, "suspend" : "BrowserSub", - "run" : 100, + "run" : 100 }, "BrowserDisplay" : { "priority" : -6, @@ -73,7 +73,7 @@ "unlock" : "mutex11", "run" : 300, "resume" : "Binder-display", - "run" : 400, + "run" : 400 }, "Binder-dummy" : { "priority" : -6, @@ -85,7 +85,7 @@ "lock" : "mutex11", "signal" : "queue11", "unlock" : "mutex11", - "run" : 100, + "run" : 100 }, "Binder-display" : { "priority" : -6, @@ -93,7 +93,7 @@ "suspend", "run" : 300, "resume" : "Event-Browser", - "resume" : "Event-Display", + "resume" : "Event-Display" }, "Event-Browser" : { "priority" : -9, @@ -102,7 +102,7 @@ "run" : 50, "sleep" : 16000, "run" : 50, - "resume" : "Browser", + "resume" : "Browser" }, "Event-Display" : { "priority" : -9, @@ -111,13 +111,13 @@ "run" : 50, "sleep" : 16000, "run" : 50, - "resume" : "Display", + "resume" : "Display" }, "Display" : { "priority" : -8, "loop" : -1, "suspend", - "run" : 16000, - }, - }, + "run" : 16000 + } + } } diff --git a/doc/examples/example1.json b/doc/examples/example1.json index bf3fe1e..df4df4f 100644 --- a/doc/examples/example1.json +++ b/doc/examples/example1.json @@ -7,7 +7,7 @@ "thread0" : { "loop" : -1, "run" : 1000, - "sleep" : 9000, - }, - }, + "sleep" : 9000 + } + } } diff --git a/doc/examples/example2.json b/doc/examples/example2.json index c5116f6..a1d9746 100644 --- a/doc/examples/example2.json +++ b/doc/examples/example2.json @@ -5,9 +5,10 @@ */ "tasks" : { "thread0" : { + "instance" : 1, "loop" : -1, "run" : 1000, - "timer" : { "ref" : "tick", "period" : 10000 }, - }, - }, + "timer" : { "ref" : "tick", "period" : 10000 } + } + } } diff --git a/doc/examples/example3.json b/doc/examples/example3.json index 56039c3..4ec6e0d 100644 --- a/doc/examples/example3.json +++ b/doc/examples/example3.json @@ -10,14 +10,14 @@ "light" : { "loop" : 100, "run" : 1000, - "timer" : { "ref" : "tick", "period" : 10000 }, + "timer" : { "ref" : "tick", "period" : 10000 } }, "heavy" : { "loop" : 100, "run" : 9000, - "timer" : { "ref" : "tick", "period" : 10000 }, + "timer" : { "ref" : "tick", "period" : 10000 } } } - }, - }, + } + } } diff --git a/doc/examples/example4.json b/doc/examples/example4.json index 2865075..19d2be2 100644 --- a/doc/examples/example4.json +++ b/doc/examples/example4.json @@ -8,13 +8,13 @@ "loop" : -1, "run" : 10000, "resume" : "thread1", - "suspend", + "suspend" }, "thread1" : { "loop" : -1, "run" : 10000, "resume" : "thread0", - "suspend", - }, - }, + "suspend" + } + } } diff --git a/doc/examples/mp3.json b/doc/examples/mp3.json index c1b40f0..b42e7d5 100644 --- a/doc/examples/mp3.json +++ b/doc/examples/mp3.json @@ -7,11 +7,11 @@ "p1" : { "loop" : 1, "resume" : "AudioOut", - "timer" : { "ref" : "tick", "period": 6000 }, + "timer" : { "ref" : "tick", "period": 6000 } }, "p2" : { "loop" : 4, - "timer" : { "ref" : "tick", "period": 6000 }, + "timer" : { "ref" : "tick", "period": 6000 } } } }, @@ -21,14 +21,14 @@ "run" : 275, "resume" : "AudioTrack", "run" : 4725, - "suspend", + "suspend" }, "AudioTrack" : { "priority" : -16, "loop" : -1, "suspend", "run" : 300, - "resume" : "mp3.decoder", + "resume" : "mp3.decoder" }, "mp3.decoder" : { "priority" : -2, @@ -39,7 +39,7 @@ "signal" : "queue", "wait" : { "ref" : "queue", "mutex": "mutex" }, "unlock" : "mutex", - "run" : 150, + "run" : 150 }, "OMXCall" : { "priority" : -2, @@ -50,8 +50,8 @@ "run" : 300, "lock" : "mutex", "signal" : "queue", - "unlock" : "mutex", - }, + "unlock" : "mutex" + } }, "global" : { "default_policy" : "SCHED_OTHER", @@ -62,6 +62,6 @@ "log_basename" : "mp3", "lock_pages" : true, "frag" : 1, - "calibration" : "CPU0", + "calibration" : "CPU0" } }
On 19 November 2014 at 14:14, pi-cheng.chen pi-cheng.chen@linaro.org wrote:
Add key "instance" in example2.json so that the file is flexible to generate workload with multiple small tasks.
Fix all trailing commas in /doc/examples/* so that those JSON file could be
The previous are already merged
tuned by tune_json.py script. A trailing comma in mp3.json needs to be removed manually since it's added by workgen script when adding suspend key.
I have done the test but i can't see trailing comma on mp3.json after running workgen on it
Signed-off-by: Pi-Cheng Chen pi-cheng.chen@linaro.org
doc/examples/browser.json | 36 ++++++++++++++++++------------------ doc/examples/example1.json | 6 +++--- doc/examples/example2.json | 7 ++++--- doc/examples/example3.json | 8 ++++---- doc/examples/example4.json | 8 ++++---- doc/examples/mp3.json | 16 ++++++++-------- 6 files changed, 41 insertions(+), 40 deletions(-)
diff --git a/doc/examples/browser.json b/doc/examples/browser.json index a5b4dee..b1436c6 100644 --- a/doc/examples/browser.json +++ b/doc/examples/browser.json @@ -9,57 +9,57 @@ "run" : 15000, "resume" : "Browser", "run" : 7000,
"sleep" : 8000,
"sleep" : 8000 }, "render1" : { "loop" : 50, "resume" : "BrowserSub",
"run" : 3000,
"run" : 3000 }, "render2" : { "loop" : 1, "suspend" : "Browser", "run" : 10000, "resume" : "Browser",
"run" : 5000,
"run" : 5000 }, "render3" : { "loop" : 20, "resume" : "BrowserSub",
"run" : 3000,
"run" : 3000 }, "stop" : { "loop" : 1, "run" : 2000, "sleep" : 200000, "suspend" : "Browser",
"sleep" : 600000,
"sleep" : 600000 }, "scroll" : { "loop" : 4, "resume" : "Browser", "suspend" : "BrowserNext",
"run" : 1000,
"run" : 1000 }, "stop2" : { "loop" : 1, "suspend" : "Browser", "run" : 200,
"sleep" : 800000,
},
"sleep" : 800000
} } }, "BrowserSub1" : { "priority" : -6, "loop" : -1, "suspend" : "BrowserSub",
"run" : 100,
"run" : 100 }, "BrowserSub2" : { "priority" : -6, "loop" : -1, "suspend" : "BrowserSub",
"run" : 100,
"run" : 100 }, "BrowserDisplay" : { "priority" : -6,
@@ -73,7 +73,7 @@ "unlock" : "mutex11", "run" : 300, "resume" : "Binder-display",
"run" : 400,
"run" : 400 }, "Binder-dummy" : { "priority" : -6,
@@ -85,7 +85,7 @@ "lock" : "mutex11", "signal" : "queue11", "unlock" : "mutex11",
"run" : 100,
"run" : 100 }, "Binder-display" : { "priority" : -6,
@@ -93,7 +93,7 @@ "suspend", "run" : 300, "resume" : "Event-Browser",
"resume" : "Event-Display",
"resume" : "Event-Display" }, "Event-Browser" : { "priority" : -9,
@@ -102,7 +102,7 @@ "run" : 50, "sleep" : 16000, "run" : 50,
"resume" : "Browser",
"resume" : "Browser" }, "Event-Display" : { "priority" : -9,
@@ -111,13 +111,13 @@ "run" : 50, "sleep" : 16000, "run" : 50,
"resume" : "Display",
"resume" : "Display" }, "Display" : { "priority" : -8, "loop" : -1, "suspend",
"run" : 16000,
},
},
"run" : 16000
}
}
} diff --git a/doc/examples/example1.json b/doc/examples/example1.json index bf3fe1e..df4df4f 100644 --- a/doc/examples/example1.json +++ b/doc/examples/example1.json @@ -7,7 +7,7 @@ "thread0" : { "loop" : -1, "run" : 1000,
"sleep" : 9000,
},
},
"sleep" : 9000
}
}
} diff --git a/doc/examples/example2.json b/doc/examples/example2.json index c5116f6..a1d9746 100644 --- a/doc/examples/example2.json +++ b/doc/examples/example2.json @@ -5,9 +5,10 @@ */ "tasks" : { "thread0" : {
"instance" : 1, "loop" : -1, "run" : 1000,
"timer" : { "ref" : "tick", "period" : 10000 },
},
},
"timer" : { "ref" : "tick", "period" : 10000 }
}
}
} diff --git a/doc/examples/example3.json b/doc/examples/example3.json index 56039c3..4ec6e0d 100644 --- a/doc/examples/example3.json +++ b/doc/examples/example3.json @@ -10,14 +10,14 @@ "light" : { "loop" : 100, "run" : 1000,
"timer" : { "ref" : "tick", "period" : 10000 },
"timer" : { "ref" : "tick", "period" : 10000 } }, "heavy" : { "loop" : 100, "run" : 9000,
"timer" : { "ref" : "tick", "period" : 10000 },
"timer" : { "ref" : "tick", "period" : 10000 } } }
},
},
}
}
} diff --git a/doc/examples/example4.json b/doc/examples/example4.json index 2865075..19d2be2 100644 --- a/doc/examples/example4.json +++ b/doc/examples/example4.json @@ -8,13 +8,13 @@ "loop" : -1, "run" : 10000, "resume" : "thread1",
"suspend",
"suspend" }, "thread1" : { "loop" : -1, "run" : 10000, "resume" : "thread0",
"suspend",
},
},
"suspend"
}
}
} diff --git a/doc/examples/mp3.json b/doc/examples/mp3.json index c1b40f0..b42e7d5 100644 --- a/doc/examples/mp3.json +++ b/doc/examples/mp3.json @@ -7,11 +7,11 @@ "p1" : { "loop" : 1, "resume" : "AudioOut",
"timer" : { "ref" : "tick", "period": 6000 },
"timer" : { "ref" : "tick", "period": 6000 } }, "p2" : { "loop" : 4,
"timer" : { "ref" : "tick", "period": 6000 },
"timer" : { "ref" : "tick", "period": 6000 } } } },
@@ -21,14 +21,14 @@ "run" : 275, "resume" : "AudioTrack", "run" : 4725,
"suspend",
"suspend" }, "AudioTrack" : { "priority" : -16, "loop" : -1, "suspend", "run" : 300,
"resume" : "mp3.decoder",
"resume" : "mp3.decoder" }, "mp3.decoder" : { "priority" : -2,
@@ -39,7 +39,7 @@ "signal" : "queue", "wait" : { "ref" : "queue", "mutex": "mutex" }, "unlock" : "mutex",
"run" : 150,
"run" : 150 }, "OMXCall" : { "priority" : -2,
@@ -50,8 +50,8 @@ "run" : 300, "lock" : "mutex", "signal" : "queue",
"unlock" : "mutex",
},
"unlock" : "mutex"
} }, "global" : { "default_policy" : "SCHED_OTHER",
@@ -62,6 +62,6 @@ "log_basename" : "mp3", "lock_pages" : true, "frag" : 1,
"calibration" : "CPU0",
"calibration" : "CPU0" }
}
1.9.1
On 5 March 2015 at 09:47, Vincent Guittot vincent.guittot@linaro.org wrote:
On 19 November 2014 at 14:14, pi-cheng.chen pi-cheng.chen@linaro.org wrote:
Add key "instance" in example2.json so that the file is flexible to generate workload with multiple small tasks.
Fix all trailing commas in /doc/examples/* so that those JSON file could be
The previous are already merged
tuned by tune_json.py script. A trailing comma in mp3.json needs to be removed manually since it's added by workgen script when adding suspend key.
I have done the test but i can't see trailing comma on mp3.json after running workgen on it
I have finally been able to reproduce the bug. I will fix workgen
Signed-off-by: Pi-Cheng Chen pi-cheng.chen@linaro.org
doc/examples/browser.json | 36 ++++++++++++++++++------------------ doc/examples/example1.json | 6 +++--- doc/examples/example2.json | 7 ++++--- doc/examples/example3.json | 8 ++++---- doc/examples/example4.json | 8 ++++---- doc/examples/mp3.json | 16 ++++++++-------- 6 files changed, 41 insertions(+), 40 deletions(-)
diff --git a/doc/examples/browser.json b/doc/examples/browser.json index a5b4dee..b1436c6 100644 --- a/doc/examples/browser.json +++ b/doc/examples/browser.json @@ -9,57 +9,57 @@ "run" : 15000, "resume" : "Browser", "run" : 7000,
"sleep" : 8000,
"sleep" : 8000 }, "render1" : { "loop" : 50, "resume" : "BrowserSub",
"run" : 3000,
"run" : 3000 }, "render2" : { "loop" : 1, "suspend" : "Browser", "run" : 10000, "resume" : "Browser",
"run" : 5000,
"run" : 5000 }, "render3" : { "loop" : 20, "resume" : "BrowserSub",
"run" : 3000,
"run" : 3000 }, "stop" : { "loop" : 1, "run" : 2000, "sleep" : 200000, "suspend" : "Browser",
"sleep" : 600000,
"sleep" : 600000 }, "scroll" : { "loop" : 4, "resume" : "Browser", "suspend" : "BrowserNext",
"run" : 1000,
"run" : 1000 }, "stop2" : { "loop" : 1, "suspend" : "Browser", "run" : 200,
"sleep" : 800000,
},
"sleep" : 800000
} } }, "BrowserSub1" : { "priority" : -6, "loop" : -1, "suspend" : "BrowserSub",
"run" : 100,
"run" : 100 }, "BrowserSub2" : { "priority" : -6, "loop" : -1, "suspend" : "BrowserSub",
"run" : 100,
"run" : 100 }, "BrowserDisplay" : { "priority" : -6,
@@ -73,7 +73,7 @@ "unlock" : "mutex11", "run" : 300, "resume" : "Binder-display",
"run" : 400,
"run" : 400 }, "Binder-dummy" : { "priority" : -6,
@@ -85,7 +85,7 @@ "lock" : "mutex11", "signal" : "queue11", "unlock" : "mutex11",
"run" : 100,
"run" : 100 }, "Binder-display" : { "priority" : -6,
@@ -93,7 +93,7 @@ "suspend", "run" : 300, "resume" : "Event-Browser",
"resume" : "Event-Display",
"resume" : "Event-Display" }, "Event-Browser" : { "priority" : -9,
@@ -102,7 +102,7 @@ "run" : 50, "sleep" : 16000, "run" : 50,
"resume" : "Browser",
"resume" : "Browser" }, "Event-Display" : { "priority" : -9,
@@ -111,13 +111,13 @@ "run" : 50, "sleep" : 16000, "run" : 50,
"resume" : "Display",
"resume" : "Display" }, "Display" : { "priority" : -8, "loop" : -1, "suspend",
"run" : 16000,
},
},
"run" : 16000
}
}
} diff --git a/doc/examples/example1.json b/doc/examples/example1.json index bf3fe1e..df4df4f 100644 --- a/doc/examples/example1.json +++ b/doc/examples/example1.json @@ -7,7 +7,7 @@ "thread0" : { "loop" : -1, "run" : 1000,
"sleep" : 9000,
},
},
"sleep" : 9000
}
}
} diff --git a/doc/examples/example2.json b/doc/examples/example2.json index c5116f6..a1d9746 100644 --- a/doc/examples/example2.json +++ b/doc/examples/example2.json @@ -5,9 +5,10 @@ */ "tasks" : { "thread0" : {
"instance" : 1, "loop" : -1, "run" : 1000,
"timer" : { "ref" : "tick", "period" : 10000 },
},
},
"timer" : { "ref" : "tick", "period" : 10000 }
}
}
} diff --git a/doc/examples/example3.json b/doc/examples/example3.json index 56039c3..4ec6e0d 100644 --- a/doc/examples/example3.json +++ b/doc/examples/example3.json @@ -10,14 +10,14 @@ "light" : { "loop" : 100, "run" : 1000,
"timer" : { "ref" : "tick", "period" : 10000 },
"timer" : { "ref" : "tick", "period" : 10000 } }, "heavy" : { "loop" : 100, "run" : 9000,
"timer" : { "ref" : "tick", "period" : 10000 },
"timer" : { "ref" : "tick", "period" : 10000 } } }
},
},
}
}
} diff --git a/doc/examples/example4.json b/doc/examples/example4.json index 2865075..19d2be2 100644 --- a/doc/examples/example4.json +++ b/doc/examples/example4.json @@ -8,13 +8,13 @@ "loop" : -1, "run" : 10000, "resume" : "thread1",
"suspend",
"suspend" }, "thread1" : { "loop" : -1, "run" : 10000, "resume" : "thread0",
"suspend",
},
},
"suspend"
}
}
} diff --git a/doc/examples/mp3.json b/doc/examples/mp3.json index c1b40f0..b42e7d5 100644 --- a/doc/examples/mp3.json +++ b/doc/examples/mp3.json @@ -7,11 +7,11 @@ "p1" : { "loop" : 1, "resume" : "AudioOut",
"timer" : { "ref" : "tick", "period": 6000 },
"timer" : { "ref" : "tick", "period": 6000 } }, "p2" : { "loop" : 4,
"timer" : { "ref" : "tick", "period": 6000 },
"timer" : { "ref" : "tick", "period": 6000 } } } },
@@ -21,14 +21,14 @@ "run" : 275, "resume" : "AudioTrack", "run" : 4725,
"suspend",
"suspend" }, "AudioTrack" : { "priority" : -16, "loop" : -1, "suspend", "run" : 300,
"resume" : "mp3.decoder",
"resume" : "mp3.decoder" }, "mp3.decoder" : { "priority" : -2,
@@ -39,7 +39,7 @@ "signal" : "queue", "wait" : { "ref" : "queue", "mutex": "mutex" }, "unlock" : "mutex",
"run" : 150,
"run" : 150 }, "OMXCall" : { "priority" : -2,
@@ -50,8 +50,8 @@ "run" : 300, "lock" : "mutex", "signal" : "queue",
"unlock" : "mutex",
},
"unlock" : "mutex"
} }, "global" : { "default_policy" : "SCHED_OTHER",
@@ -62,6 +62,6 @@ "log_basename" : "mp3", "lock_pages" : true, "frag" : 1,
"calibration" : "CPU0",
"calibration" : "CPU0" }
}
1.9.1