diff --git a/testsuites/sptests/sptimecounter02/init.c b/testsuites/sptests/sptimecounter02/init.c
index 95b6292359..ff05f147de 100644
--- a/testsuites/sptests/sptimecounter02/init.c
+++ b/testsuites/sptests/sptimecounter02/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2015 embedded brains GmbH & Co. KG
+ * Copyright (C) 2015, 2024 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -61,6 +61,8 @@ const char rtems_test_name[] = "SPTIMECOUNTER 2";
typedef struct {
rtems_test_parallel_context base;
+ const char *test_sep;
+ const char *counter_sep;
struct timecounter tc_null;
uint32_t binuptime_per_job[CPU_COUNT];
sbintime_t duration_per_job[CPU_COUNT];
@@ -90,6 +92,45 @@ static void install_tc_null(timecounter_context *ctx)
rtems_timecounter_install(tc_cpu);
}
+static void test_print_results(
+ const char *driver,
+ timecounter_context *ctx,
+ size_t active_workers
+)
+{
+ const char *value_sep;
+ size_t i;
+
+ if (active_workers == 1) {
+ printf(
+ "%s{\n"
+ " \"timecounter\": \"%s\",\n"
+ " \"counter\": [",
+ ctx->test_sep,
+ driver
+ );
+ ctx->test_sep = ", ";
+ ctx->counter_sep = "\n ";
+ }
+
+ printf("%s[", ctx->counter_sep);
+ ctx->counter_sep = "],\n ";
+ value_sep = "";
+
+ for (i = 0; i < active_workers; ++i) {
+ printf(
+ "%s%" PRIu32,
+ value_sep,
+ ctx->binuptime_per_job[i]
+ );
+ value_sep = ", ";
+ }
+
+ if (active_workers == rtems_scheduler_get_processor_maximum()) {
+ printf("]\n ]\n }");
+ }
+}
+
static rtems_interval test_bintime_init(
rtems_test_parallel_context *base,
void *arg,
@@ -133,25 +174,14 @@ static void test_bintime_fini(
timecounter_context *ctx = (timecounter_context *) base;
size_t i;
- printf(" \n", active_workers);
-
for (i = 0; i < active_workers; ++i) {
sbintime_t error;
- printf(
- " %" PRIu32 "\n"
- " %" PRId64 "\n",
- i + 1,
- ctx->binuptime_per_job[i],
- i + 1,
- ctx->duration_per_job[i]
- );
-
error = DURATION_IN_SECONDS * SBT_1S - ctx->duration_per_job[i];
rtems_test_assert(error * error < SBT_1MS * SBT_1MS);
}
- printf(" \n");
+ test_print_results("Clock Driver", ctx, active_workers);
}
static rtems_interval test_bintime_null_init(
@@ -192,20 +222,7 @@ static void test_bintime_null_fini(
size_t active_workers
)
{
- timecounter_context *ctx = (timecounter_context *) base;
- size_t i;
-
- printf(" \n", active_workers);
-
- for (i = 0; i < active_workers; ++i) {
- printf(
- " %" PRIu32 "\n",
- i + 1,
- ctx->binuptime_per_job[i]
- );
- }
-
- printf(" \n");
+ test_print_results("Null", (timecounter_context *) base, active_workers);
}
static const rtems_test_parallel_job timecounter_jobs[] = {
@@ -231,8 +248,9 @@ static void Init(rtems_task_argument arg)
TEST_BEGIN();
- printf("\n");
+ printf("*** BEGIN OF JSON DATA ***\n[\n ");
+ ctx->test_sep = "";
rtems_test_parallel(
&ctx->base,
NULL,
@@ -240,6 +258,8 @@ static void Init(rtems_task_argument arg)
RTEMS_ARRAY_SIZE(timecounter_jobs)
);
+ printf("\n]\n*** END OF JSON DATA ***\n");
+
/* Check for all functions available in the bsd.h user space */
rtems_bsd_bintime(&bt);
@@ -255,8 +275,6 @@ static void Init(rtems_task_argument arg)
rtems_bsd_getmicrouptime(&tv);
rtems_bsd_getnanouptime(&ts);
- printf("\n");
-
TEST_END();
rtems_test_exit(0);
}
diff --git a/testsuites/sptests/sptimecounter02/sptimecounter02.py b/testsuites/sptests/sptimecounter02/sptimecounter02.py
index 0782fe1102..198255c140 100755
--- a/testsuites/sptests/sptimecounter02/sptimecounter02.py
+++ b/testsuites/sptests/sptimecounter02/sptimecounter02.py
@@ -1,9 +1,6 @@
-#!/usr/bin/env python
-
# SPDX-License-Identifier: BSD-2-Clause
-#
-# Copyright (c) 2016 embedded brains GmbH & Co. KG
+# Copyright (C) 2016, 2024 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -25,37 +22,38 @@
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-#
+import json
import re
-import libxml2
-from libxml2 import xmlNode
-import matplotlib.pyplot as plt
-data = open('sptimecounter02.scn').read()
-data = re.sub(r'\*\*\*.*\*\*\*', '', data)
-doc = libxml2.parseDoc(data)
-ctx = doc.xpathNewContext()
+import matplotlib.pyplot as plt # type: ignore
+from matplotlib import ticker # type: ignore
-plt.title('Timestamp Performance')
-plt.xlabel('Active Workers')
-plt.ylabel('Operation Count')
-def m(n):
- return int(n.getContent())
+def _plot(data: dict) -> None:
+ _, axes = plt.subplots()
+ axes.set_title("Timestamp Performance")
+ axes.set_xlabel("Active Workers")
+ axes.set_ylabel("Operation Count")
+ x = list(range(1, len(data[0]["counter"]) + 1))
+ axes.xaxis.set_major_locator(ticker.FixedLocator(x))
+ for samples in data:
+ y = [sum(values) for values in samples["counter"]]
+ axes.plot(x,
+ y,
+ label=samples["timecounter"],
+ marker="o")
+ axes.legend(loc="best")
+ plt.savefig("sptimecounter02.png")
+ plt.savefig("sptimecounter02.pdf")
+ plt.close()
-def getCounterSums(variant):
- w = 1
- y = []
- while True:
- c = map(m, ctx.xpathEval('/SPTimecounter01/' + variant + '[@activeWorker="' + str(w) + '"]/Counter'))
- if not c:
- break
- y.append(sum(c))
- w = w + 1
- return y
-y = getCounterSums('BinuptimeTest')
-x = range(1, len(y) + 1)
-plt.xticks(x)
-plt.plot(x, y, marker = 'o')
-plt.show()
+_JSON_DATA = re.compile(
+ r"\*\*\* BEGIN OF JSON DATA \*\*\*(.*)"
+ r"\*\*\* END OF JSON DATA \*\*\*", re.DOTALL)
+
+with open("sptimecounter02.scn", "r", encoding="utf-8") as src:
+ match = _JSON_DATA.search(src.read())
+ data = json.loads(match.group(1))
+
+_plot(data)
diff --git a/testsuites/sptests/sptimecounter02/sptimecounter02.scn b/testsuites/sptests/sptimecounter02/sptimecounter02.scn
index 0ad38c6f4a..6acc521873 100644
--- a/testsuites/sptests/sptimecounter02/sptimecounter02.scn
+++ b/testsuites/sptests/sptimecounter02/sptimecounter02.scn
@@ -1,1000 +1,40 @@
+
+ SIS - SPARC/RISCV instruction simulator 2.30, copyright Jiri Gaisler 2020
+ Bug-reports to jiri@gaisler.se
+
+ GR740/LEON4 emulation enabled, 4 cpus online, delta 50 clocks
+
+ Loaded build/sparc/gr740/testsuites/sptests/sptimecounter02.exe, entry 0x00000000
+
+
*** BEGIN OF TEST SPTIMECOUNTER 2 ***
-
-
- 5433429
- 4291225979
-
-
- 3832225
- 4290792130
- 3834316
- 4290790869
-
-
- 2557440
- 4294943244
- 2559261
- 4294946681
- 2559529
- 4294943817
-
-
- 1916358
- 4291303174
- 1918101
- 4291303746
- 1918236
- 4291301112
- 1918182
- 4291303861
-
-
- 1437861
- 4292771136
- 1439416
- 4292769991
- 1439361
- 4292774000
- 1439373
- 4292773427
- 1919046
- 4292771480
-
-
- 1278255
- 4292980616
- 1279690
- 4292981762
- 1279546
- 4292978440
- 1279558
- 4292978096
- 1279611
- 4292980043
- 1279619
- 4292976150
-
-
- 1022765
- 4294000413
- 1024240
- 4294002246
- 1024022
- 4293998007
- 1024036
- 4293998924
- 1024020
- 4293998809
- 1024010
- 4293999382
- 1535866
- 4293999955
-
-
- 958721
- 4293767683
- 960000
- 4293768599
- 960007
- 4293764018
- 960007
- 4293764132
- 960030
- 4293764705
- 960042
- 4293764590
- 960019
- 4293768026
- 959998
- 4293763446
-
-
- 942346
- 4292128953
- 943991
- 4292136282
- 940622
- 4292123913
- 940597
- 4292128494
- 941505
- 4292126203
- 941481
- 4292126204
- 944352
- 4292126089
- 944344
- 4292126204
- 5373049
- 4292132044
-
-
- 958924
- 4292784422
- 960306
- 4292785452
- 958656
- 4292782704
- 958632
- 4292782704
- 960299
- 4292781444
- 960321
- 4292786026
- 959742
- 4292778810
- 959726
- 4292783162
- 3835189
- 4292783734
- 3835159
- 4292782475
-
-
- 958317
- 4292020376
- 959720
- 4292020490
- 959141
- 4292016024
- 959171
- 4292020376
- 959183
- 4292018199
- 959176
- 4292022666
- 960245
- 4292020376
- 960256
- 4292024041
- 2556834
- 4292019460
- 2556892
- 4292018314
- 2556777
- 4292018543
-
-
- 958527
- 4291119807
- 959937
- 4291119807
- 959932
- 4291120379
- 959924
- 4291120380
- 959389
- 4291120838
- 959393
- 4291123701
- 958279
- 4291118204
- 958288
- 4291118089
- 1917514
- 4291120609
- 1917516
- 4291118318
- 1917496
- 4291119463
- 1917477
- 4291116829
-
-
- 957469
- 4291772986
- 958901
- 4291772184
- 959855
- 4291766114
- 959906
- 4291770695
- 959953
- 4291779743
- 959977
- 4291769092
- 959389
- 4291770810
- 959385
- 4291766228
- 1438521
- 4291768748
- 1438502
- 4291768977
- 1438548
- 4291766687
- 1438497
- 4291770237
- 1917953
- 4291765999
-
-
- 958554
- 4293977506
- 959986
- 4293974643
- 959942
- 4293976246
- 959946
- 4293971894
- 959422
- 4293972467
- 959466
- 4293976819
- 960436
- 4293975216
- 960437
- 4293975216
- 1280753
- 4293970749
- 1280760
- 4293974529
- 1278618
- 4293975445
- 1278603
- 4293971665
- 1278806
- 4293971894
- 1278798
- 4293975673
-
-
- 958175
- 4291365823
- 959788
- 4291366969
- 959270
- 4291360783
- 959251
- 4291365250
- 958544
- 4291366854
- 958536
- 4291362502
- 959264
- 4291364105
- 959249
- 4291368571
- 1021329
- 4291362960
- 1021315
- 4291366854
- 1022881
- 4291367426
- 1022857
- 4291365135
- 1022969
- 4291365135
- 1022963
- 4291364677
- 1536939
- 4291362960
-
-
- 958710
- 4294622324
- 960272
- 4294611444
- 960318
- 4294610413
- 960325
- 4294610298
- 957982
- 4294606977
- 958010
- 4294611558
- 960811
- 4294608122
- 960866
- 4294608123
- 956789
- 4294606175
- 956816
- 4294610757
- 961812
- 4294611787
- 961815
- 4294610069
- 959509
- 4294610183
- 959511
- 4294610070
- 960164
- 4294612474
- 960191
- 4294607893
-
-
- 944571
- 4290823168
- 946274
- 4290823855
- 945546
- 4290821565
- 945535
- 4290821564
- 943940
- 4290819274
- 943961
- 4290823741
- 945996
- 4290821565
- 945999
- 4290821564
- 944038
- 4290823969
- 944031
- 4290819503
- 944055
- 4290824543
- 944036
- 4290820076
- 945985
- 4290821221
- 945985
- 4290821221
- 946541
- 4290819503
- 946539
- 4290819388
- 5319165
- 4290821221
-
-
- 957435
- 4292140979
- 959052
- 4292138230
- 959020
- 4292138115
- 959034
- 4292138230
- 959057
- 4292137199
- 959078
- 4292136969
- 959758
- 4292139375
- 959770
- 4292139261
- 959102
- 4292136855
- 959101
- 4292141322
- 957493
- 4292141322
- 957490
- 4292136741
- 960923
- 4292141895
- 960933
- 4292139146
- 958227
- 4292139032
- 958201
- 4292134565
- 3833107
- 4292138229
- 3833100
- 4292137085
-
-
- 959131
- 4295003603
- 960752
- 4295005321
- 958958
- 4295009444
- 958960
- 4295001312
- 960052
- 4295001771
- 960086
- 4295001885
- 960031
- 4295003603
- 960043
- 4294999021
- 961650
- 4295005435
- 961687
- 4295001885
- 960613
- 4295011276
- 960593
- 4295000854
- 959538
- 4295001427
- 959574
- 4295001427
- 956810
- 4295003717
- 956818
- 4295003603
- 2557866
- 4295002687
- 2557901
- 4295000969
- 2557791
- 4295000968
-
-
- 956818
- 4290849167
- 958477
- 4290849052
- 959502
- 4290848594
- 959493
- 4290848594
- 959067
- 4290848021
- 959118
- 4290848021
- 958349
- 4290853175
- 958323
- 4290846303
- 957048
- 4290847563
- 957074
- 4290847678
- 960084
- 4290846418
- 960074
- 4290846418
- 959020
- 4290845846
- 959039
- 4290850426
- 958126
- 4290845960
- 958095
- 4290845845
- 1916573
- 4290848136
- 1916534
- 4290845845
- 1916572
- 4290848136
- 1916533
- 4290845845
-
-
- 958421
- 4294761939
- 960077
- 4294760221
- 959148
- 4294754953
- 959141
- 4294759649
- 959688
- 4294754494
- 959736
- 4294759076
- 960425
- 4294760221
- 960396
- 4294755755
- 958447
- 4294756213
- 958469
- 4294756327
- 960168
- 4294759076
- 960140
- 4294754495
- 961301
- 4294767323
- 961331
- 4294756785
- 958210
- 4294757358
- 958203
- 4294757358
- 1439060
- 4294757931
- 1439023
- 4294758159
- 1439103
- 4294758045
- 1439064
- 4294757930
- 1918367
- 4294758045
-
-
- 958582
- 4291633485
- 960264
- 4291633599
- 958919
- 4291636921
- 958961
- 4291632912
- 958913
- 4291634631
- 958982
- 4291634630
- 957838
- 4291633027
- 957849
- 4291632912
- 958935
- 4291632340
- 958978
- 4291632455
- 958040
- 4291631194
- 958060
- 4291635203
- 958031
- 4291634745
- 958035
- 4291630163
- 959809
- 4291635776
- 959833
- 4291631309
- 1278240
- 4291631194
- 1278239
- 4291634745
- 1278855
- 4291629591
- 1278855
- 4291632913
- 1277332
- 4291632912
- 1277327
- 4291635891
-
-
- 958870
- 4294362908
- 960652
- 4294358327
- 957192
- 4294358327
- 957194
- 4294362793
- 960437
- 4294358900
- 960480
- 4294359014
- 958820
- 4294362908
- 958835
- 4294360045
- 956488
- 4294360617
- 956549
- 4294356151
- 961870
- 4294356151
- 961835
- 4294360732
- 961302
- 4294361191
- 961345
- 4294356724
- 956489
- 4294360045
- 956506
- 4294360160
- 1021387
- 4294356952
- 1021417
- 4294360961
- 1021929
- 4294359243
- 1021926
- 4294359930
- 1024098
- 4294358327
- 1024083
- 4294358098
- 1537525
- 4294361076
-
-
- 958462
- 4294344239
- 960113
- 4294339773
- 959461
- 4294341949
- 959473
- 4294344812
- 958912
- 4294341490
- 958938
- 4294341376
- 958935
- 4294340230
- 958921
- 4294340345
- 959876
- 4294341491
- 959892
- 4294337138
- 959045
- 4294338284
- 959020
- 4294342636
- 961635
- 4294341033
- 961646
- 4294343782
- 956010
- 4294338856
- 956016
- 4294343208
- 960207
- 4294339887
- 960171
- 4294339772
- 960089
- 4294340346
- 960077
- 4294340346
- 957194
- 4294339315
- 957184
- 4294339200
- 959119
- 4294344812
- 959094
- 4294341948
-
-
- 19386783
-
-
- 18966996
- 18976413
-
-
- 18974430
- 18983328
- 19416623
-
-
- 19008674
- 19018198
- 19008964
- 19008692
-
-
- 19020812
- 19030365
- 19005570
- 19005064
- 19403356
-
-
- 19022252
- 19032184
- 18989113
- 18988868
- 19032006
- 19033563
-
-
- 19030040
- 19040103
- 19027768
- 19027395
- 19032442
- 19034065
- 19412449
-
-
- 19025699
- 19035838
- 19004615
- 19004706
- 19030244
- 19032199
- 19024756
- 19023713
-
-
- 19013669
- 19023620
- 19002201
- 19002347
- 19045897
- 19048005
- 19008510
- 19007710
- 19395234
-
-
- 19027122
- 19037161
- 19009823
- 19010172
- 19038718
- 19040747
- 19031970
- 19031243
- 19073032
- 19074455
-
-
- 19028856
- 19038950
- 19011087
- 19010918
- 19042804
- 19044814
- 19009000
- 19008045
- 19062056
- 19063324
- 19425237
-
-
- 19000686
- 19010524
- 19011200
- 19011161
- 19040651
- 19042336
- 19008991
- 19008322
- 19057966
- 19059942
- 19025294
- 19024237
-
-
- 19035788
- 19045670
- 19019672
- 19019535
- 19057435
- 19059507
- 19015462
- 19015005
- 19075133
- 19076837
- 19015711
- 19014041
- 19397278
-
-
- 19042430
- 19052163
- 18991353
- 18991104
- 19055723
- 19057975
- 19037925
- 19037320
- 19093382
- 19095573
- 19013959
- 19012664
- 19047902
- 19049501
-
-
- 19031341
- 19041295
- 19021603
- 19021349
- 19070154
- 19072132
- 19012455
- 19011763
- 19078313
- 19081070
- 19007359
- 19006010
- 19079061
- 19080701
- 19419748
-
-
- 19026392
- 19036011
- 19020535
- 19020505
- 19027761
- 19029769
- 19007387
- 19006701
- 19079449
- 19081866
- 19016942
- 19015669
- 19053837
- 19056122
- 19017232
- 19015864
-
-
- 19024720
- 19034397
- 19010358
- 19009952
- 19045360
- 19047250
- 19015505
- 19014894
- 19067467
- 19069766
- 19001455
- 19000148
- 19062397
- 19064161
- 18988213
- 18986839
- 19392710
-
-
- 19014459
- 19024385
- 19004536
- 19004360
- 19059651
- 19061446
- 18995175
- 18994526
- 19069645
- 19072049
- 19020094
- 19018465
- 19084049
- 19085700
- 19010799
- 19009469
- 19062621
- 19062665
-
-
- 19027369
- 19037193
- 19017667
- 19017624
- 19025425
- 19027799
- 19017922
- 19017381
- 19029266
- 19031825
- 19025025
- 19023564
- 19057381
- 19059412
- 19025461
- 19023734
- 19049991
- 19051542
- 19418712
-
-
- 19042934
- 19052696
- 19038771
- 19038516
- 19033526
- 19035338
- 19043236
- 19042713
- 19086859
- 19089153
- 19022766
- 19021740
- 19061402
- 19063648
- 19019723
- 19018344
- 19049944
- 19051860
- 19024515
- 19024160
-
-
- 19024204
- 19034080
- 19000776
- 19000755
- 19051386
- 19053223
- 18986331
- 18985787
- 19090476
- 19093070
- 19014901
- 19013812
- 19076062
- 19077825
- 19009098
- 19007749
- 19068241
- 19070586
- 18985454
- 18984893
- 19400999
-
-
- 19031656
- 19041556
- 19002695
- 19002754
- 19077008
- 19078695
- 18989542
- 18988653
- 19044533
- 19046959
- 19004288
- 19003156
- 19062162
- 19064009
- 19034105
- 19032889
- 19067368
- 19070169
- 19008530
- 19008397
- 19037841
- 19040158
-
-
- 19019317
- 19029201
- 19010298
- 19010487
- 19030794
- 19032697
- 19001815
- 19001431
- 19067361
- 19069729
- 19001399
- 19000051
- 19070247
- 19072221
- 19020770
- 19019396
- 19085756
- 19088597
- 19014748
- 19014660
- 19044229
- 19046314
- 19421247
-
-
- 19016838
- 19026664
- 18978854
- 18978559
- 19034822
- 19036646
- 19006174
- 19005608
- 19042579
- 19044966
- 19007697
- 19006331
- 19053232
- 19054892
- 18999211
- 18997906
- 19065292
- 19067828
- 19014259
- 19013886
- 19047296
- 19048410
- 19017171
- 19016766
-
-
+*** TEST VERSION: 6.0.0.105c3e541c26113503080c65006ad775d31fca3d
+*** TEST STATE: EXPECTED_PASS
+*** TEST BUILD: RTEMS_SMP
+*** TEST TOOLS: 13.2.0 20230727 (RTEMS 6, RSB d3d738c35a71ca05f675b188539225099401ac79, Newlib a021448)
+*** BEGIN OF JSON DATA ***
+[
+ {
+ "timecounter": "Clock Driver",
+ "counter": [
+ [523086],
+ [523088, 528231],
+ [523088, 528232, 528231],
+ [523088, 528215, 528215, 527992]
+ ]
+ }, {
+ "timecounter": "Null",
+ "counter": [
+ [528630],
+ [528662, 533818],
+ [528684, 533839, 533840],
+ [528664, 533821, 533821, 533582]
+ ]
+ }
+]
+*** END OF JSON DATA ***
+
*** END OF TEST SPTIMECOUNTER 2 ***
+
+cpu 0 in error mode (tt = 0x80)
+ 400337050 00009120: 91d02000 ta 0x0