Skip to content

Commit cb863ec

Browse files
nonassaAlan Lan
authored andcommitted
Add missing SessionErrorCode cases to error_message_bench for TICKET_486 enum values (TICKET_489)
1 parent a522ad5 commit cb863ec

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

benchmarks/error_message_bench.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ namespace old_impl {
5151
case nfx::SessionErrorCode::SequenceGap: return "Sequence gap detected";
5252
case nfx::SessionErrorCode::InvalidState: return "Invalid session state";
5353
case nfx::SessionErrorCode::Disconnected: return "Disconnected";
54+
case nfx::SessionErrorCode::CompIdMismatch: return "CompID mismatch";
55+
case nfx::SessionErrorCode::SendingTimeAccuracy: return "SendingTime accuracy problem";
5456
}
5557
return "Unknown error";
5658
}
@@ -135,7 +137,7 @@ constexpr std::array<nfx::ParseErrorCode, 15> ALL_PARSE_ERRORS = {
135137
nfx::ParseErrorCode::FieldCountExceeded
136138
};
137139

138-
constexpr std::array<nfx::SessionErrorCode, 9> ALL_SESSION_ERRORS = {
140+
constexpr std::array<nfx::SessionErrorCode, 11> ALL_SESSION_ERRORS = {
139141
nfx::SessionErrorCode::None,
140142
nfx::SessionErrorCode::NotConnected,
141143
nfx::SessionErrorCode::AlreadyConnected,
@@ -144,7 +146,9 @@ constexpr std::array<nfx::SessionErrorCode, 9> ALL_SESSION_ERRORS = {
144146
nfx::SessionErrorCode::HeartbeatTimeout,
145147
nfx::SessionErrorCode::SequenceGap,
146148
nfx::SessionErrorCode::InvalidState,
147-
nfx::SessionErrorCode::Disconnected
149+
nfx::SessionErrorCode::Disconnected,
150+
nfx::SessionErrorCode::CompIdMismatch,
151+
nfx::SessionErrorCode::SendingTimeAccuracy
148152
};
149153

150154
constexpr std::array<nfx::TransportErrorCode, 20> ALL_TRANSPORT_ERRORS = {
@@ -239,7 +243,7 @@ int main() {
239243
// Benchmark 2: SessionError message()
240244
// ========================================================================
241245

242-
std::cout << "--- SessionError (9 codes, " << ITERATIONS << " iterations) ---\n\n";
246+
std::cout << "--- SessionError (11 codes, " << ITERATIONS << " iterations) ---\n\n";
243247

244248
// OLD: Switch-based
245249
uint64_t old_session_start = rdtsc();
@@ -395,7 +399,7 @@ int main() {
395399
std::cout << "|------------------|--------------|--------------|-------------|\n";
396400
std::cout << "| Average | | | " << avg_improvement << "% |\n";
397401

398-
std::cout << "\nTotal switch cases eliminated: 53 (15 + 9 + 20 + 9)\n";
402+
std::cout << "\nTotal switch cases eliminated: 55 (15 + 11 + 20 + 9)\n";
399403

400404
return 0;
401405
}

0 commit comments

Comments
 (0)