34
34
#include " simdjson/parsedjson.h"
35
35
#include " simdjson/stage1_find_marks.h"
36
36
#include " simdjson/stage2_build_tape.h"
37
+
38
+ // Global arguments
39
+ static bool find_marks_only = false ;
40
+
37
41
namespace simdjson {
38
42
Architecture _find_best_supported_implementation () {
39
43
constexpr uint32_t haswell_flags =
@@ -63,6 +67,9 @@ extern unified_functype *unified_ptr;
63
67
extern stage1_functype *stage1_ptr;
64
68
65
69
int unified_machine_dispatch (const uint8_t *buf, size_t len, ParsedJson &pj) {
70
+ if (find_marks_only) {
71
+ return simdjson::SUCCESS;
72
+ }
66
73
Architecture best_implementation = _find_best_supported_implementation ();
67
74
// Selecting the best implementation
68
75
switch (best_implementation) {
@@ -129,7 +136,7 @@ int main(int argc, char *argv[]) {
129
136
#ifndef _MSC_VER
130
137
int c;
131
138
132
- while ((c = getopt (argc, argv, " 1vdtn:w:" )) != -1 ) {
139
+ while ((c = getopt (argc, argv, " 1vdtn:w:f " )) != -1 ) {
133
140
switch (c) {
134
141
case ' n' :
135
142
iterations = atoi (optarg );
@@ -152,6 +159,9 @@ int main(int argc, char *argv[]) {
152
159
case ' 1' :
153
160
force_one_iteration = true ;
154
161
break ;
162
+ case ' f' :
163
+ find_marks_only = true ;
164
+ break ;
155
165
default :
156
166
abort ();
157
167
}
@@ -326,7 +336,7 @@ int main(int argc, char *argv[]) {
326
336
isok = (simdjson::stage1_ptr ((const uint8_t *)p.data (), p.size (), pj) ==
327
337
simdjson::SUCCESS);
328
338
isok = isok &&
329
- (simdjson::SUCCESS ==
339
+ (simdjson::SUCCESS ==
330
340
simdjson::unified_ptr ((const uint8_t *)p.data (), p.size (), pj));
331
341
auto end = std::chrono::steady_clock::now ();
332
342
std::chrono::duration<double > secs = end - start;
0 commit comments