config_parser: Add performance measuring test code

Disabled by default for CI performance, but it always compiles in order
to prevent staleness.

Change-Id: I8a981404e19892bdd710cb7db53941c510285ee5
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/test_config_parser.cpp b/test/test_config_parser.cpp
index 6aa3811..ec90a5f 100644
--- a/test/test_config_parser.cpp
+++ b/test/test_config_parser.cpp
@@ -1,11 +1,15 @@
 #include "config_parser.hpp"
 
+#include <fmt/chrono.h>
+#include <fmt/compile.h>
 #include <fmt/format.h>
 
 #include <exception>
 #include <fstream>
 #include <phosphor-logging/elog-errors.hpp>
 #include <stdexcept>
+#include <stdplus/fd/atomic.hpp>
+#include <stdplus/fd/fmt.hpp>
 #include <stdplus/gtest/tmp.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
@@ -51,6 +55,31 @@
     EXPECT_THAT(parser.getValues("Network", "nil"), ElementsAre());
 }
 
+TEST_F(TestConfigParser, Perf)
+{
+    GTEST_SKIP();
+    stdplus::fd::AtomicWriter file(fmt::format("{}/tmp.XXXXXX", CaseTmpDir()),
+                                   0600);
+    stdplus::fd::FormatBuffer out(file);
+    for (size_t i = 0; i < 500; ++i)
+    {
+        out.append(FMT_COMPILE("[{:a>{}}]\n"), "", i + 1);
+        for (size_t j = 0; j < 70; j++)
+        {
+            const size_t es = i * 70 + j + 1;
+            out.append(FMT_COMPILE("{:b>{}}={:c>{}}\n"), "", es, "", es);
+        }
+    }
+    out.flush();
+    file.commit();
+
+    auto start = std::chrono::steady_clock::now();
+    parser.setFile(filename);
+    fmt::print("Duration: {}\n", std::chrono::steady_clock::now() - start);
+    // Make sure this test isn't enabled
+    EXPECT_FALSE(true);
+}
+
 } // namespace config
 } // namespace network
 } // namespace phosphor