-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding TLC stats to cimetrics (#5807)
- Loading branch information
1 parent
1d52533
commit 6e0f675
Showing
9 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ monitoring_span: 150 | |
groups: | ||
"SGX": ".*_sgx_.*" | ||
"Virtual": ".*_virtual_.*" | ||
"TLC": "tlc_.*" | ||
"Others": ".*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache 2.0 License. | ||
|
||
import json | ||
import os | ||
import argparse | ||
import cimetrics.upload | ||
|
||
from loguru import logger as LOG | ||
|
||
|
||
def run(test_label, filename): | ||
if os.path.exists(filename): | ||
with open(filename) as f: | ||
data = json.load(f) | ||
duration_sec = data["duration"] | ||
dstates = data["distinct"] | ||
LOG.info( | ||
"Uploading metrics for {} - duration: {}, distinct states: {}", | ||
test_label, | ||
duration_sec, | ||
dstates, | ||
) | ||
with cimetrics.upload.metrics(complete=False) as metrics: | ||
metrics.put(f"tlc_{test_label}_duration_s", duration_sec) | ||
metrics.put(f"tlc_{test_label}_states", dstates) | ||
|
||
else: | ||
LOG.warning(f"Could not find file {filename}: skipping metrics upload") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Upload TLC stats to cimetrics.") | ||
|
||
parser.add_argument( | ||
"test_label", | ||
help="test name to upload metrics under", | ||
) | ||
|
||
parser.add_argument( | ||
"filename", | ||
help="TLC stats JSON file to upload", | ||
) | ||
|
||
args = parser.parse_args() | ||
run(args.test_label, args.filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ tools/ | |
*.dot | ||
*TTrace*.tla | ||
*TTrace*.bin | ||
**/states.dump* | ||
*_stats.json | ||
**/states.dump* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
---- MODULE StatsFile---- | ||
EXTENDS TLC, Json, Sequences | ||
|
||
\* Filename to write TLC stats to | ||
CONSTANT StatsFilename | ||
ASSUME StatsFilename \in STRING | ||
|
||
\* Writes TLC stats (such as number of states and duration) to StatsFilename in ndJson format | ||
\* Specify WriteStatsFile as a postcondition to write the stats file at the end of model checking | ||
WriteStatsFile == | ||
/\ PrintT("Writing stats to file: " \o StatsFilename) | ||
/\ ndJsonSerialize(StatsFilename, <<TLCGet("stats")>>) | ||
|
||
==== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters