From f716e8115c46def41ff7bfbd6420e119abfb2520 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 27 Jun 2017 17:14:01 -0700 Subject: [PATCH] Add benchmarking. Change-Id: I92b8d1d27d5d6b79a831853446e83086fa56a133 --- engine/src/flutter/benchmarks/BUILD.gn | 45 ++++ .../benchmarks/font_collection_benchmarks.cc | 49 +++++ .../benchmarks/paragraph_benchmarks.cc | 116 +++++++++++ .../paragraph_builder_benchmarks.cc | 194 ++++++++++++++++++ .../benchmarks/txt_run_all_benchmarks.cc | 41 ++++ engine/src/flutter/benchmarks/utils.cc | 43 ++++ engine/src/flutter/benchmarks/utils.h | 31 +++ engine/src/flutter/src/paragraph.cc | 3 +- engine/src/flutter/src/paragraph.h | 1 + engine/src/flutter/tests/txt/utils.cc | 8 +- engine/src/flutter/tests/txt/utils.h | 2 +- 11 files changed, 527 insertions(+), 6 deletions(-) create mode 100644 engine/src/flutter/benchmarks/BUILD.gn create mode 100644 engine/src/flutter/benchmarks/font_collection_benchmarks.cc create mode 100644 engine/src/flutter/benchmarks/paragraph_benchmarks.cc create mode 100644 engine/src/flutter/benchmarks/paragraph_builder_benchmarks.cc create mode 100644 engine/src/flutter/benchmarks/txt_run_all_benchmarks.cc create mode 100644 engine/src/flutter/benchmarks/utils.cc create mode 100644 engine/src/flutter/benchmarks/utils.h diff --git a/engine/src/flutter/benchmarks/BUILD.gn b/engine/src/flutter/benchmarks/BUILD.gn new file mode 100644 index 0000000000..7a3f14d7d7 --- /dev/null +++ b/engine/src/flutter/benchmarks/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright 2017 Google, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +executable("benchmarks") { + output_name = "txt_benchmarks" + + include_dirs = [ + "//lib/txt/src", + "//lib/txt/include", + "//third_party/icu/source", + ] + + sources = [ + "font_collection_benchmarks.cc", + "paragraph_benchmarks.cc", + "paragraph_builder_benchmarks.cc", + "txt_run_all_benchmarks.cc", + "utils.cc", + "utils.h", + ] + + deps = [ + "//dart/runtime:libdart_jit", # Logging + "//flutter/fml", + "//lib/txt/shims", + "//lib/txt", + "//build/secondary/testing/benchmark", + "//third_party/skia", + "//third_party/harfbuzz", + "//lib/txt/libs/minikin", + ] + + +} diff --git a/engine/src/flutter/benchmarks/font_collection_benchmarks.cc b/engine/src/flutter/benchmarks/font_collection_benchmarks.cc new file mode 100644 index 0000000000..10751e324f --- /dev/null +++ b/engine/src/flutter/benchmarks/font_collection_benchmarks.cc @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "third_party/benchmark/include/benchmark/benchmark_api.h" + +#include "lib/ftl/command_line.h" +#include "lib/ftl/logging.h" +#include "lib/txt/src/font_collection.h" +#include "utils.h" + +namespace txt { + +// Include this fake bench first because the first benchmark produces +// inconsistent times. +static void BM_FAKE_BENCHMARK(benchmark::State& state) { + while (state.KeepRunning()) { + continue; + } +} +BENCHMARK(BM_FAKE_BENCHMARK); + +static void BM_FontCollectionInit(benchmark::State& state) { + while (state.KeepRunning()) { + FontCollection::GetFontCollection(txt::GetFontDir()); + } +} +BENCHMARK(BM_FontCollectionInit); + +static void BM_FontCollectionGetMinikinFontCollectionForFamily(benchmark::State& state) { + while (state.KeepRunning()) { + FontCollection::GetFontCollection(txt::GetFontDir()).GetMinikinFontCollectionForFamily("Roboto"); + } +} +BENCHMARK(BM_FontCollectionGetMinikinFontCollectionForFamily); + +} // namespace txt diff --git a/engine/src/flutter/benchmarks/paragraph_benchmarks.cc b/engine/src/flutter/benchmarks/paragraph_benchmarks.cc new file mode 100644 index 0000000000..34d44ad557 --- /dev/null +++ b/engine/src/flutter/benchmarks/paragraph_benchmarks.cc @@ -0,0 +1,116 @@ +/* + * Copyright 2017 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "third_party/benchmark/include/benchmark/benchmark_api.h" + +#include "lib/ftl/command_line.h" +#include "lib/ftl/logging.h" +#include "lib/txt/src/font_style.h" +#include "lib/txt/src/font_weight.h" +#include "lib/txt/src/paragraph.h" +#include "lib/txt/src/paragraph_builder.h" +#include "lib/txt/src/text_align.h" +#include "third_party/icu/source/common/unicode/unistr.h" +#include "third_party/skia/include/core/SkColor.h" +#include "utils.h" + +namespace txt { + +static void BM_ParagraphShortLayout(benchmark::State& state) { + const char* text = "Hello World"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + while (state.KeepRunning()) { + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + + builder.PushStyle(text_style); + builder.AddText(u16_text); + builder.Pop(); + auto paragraph = builder.Build(); + paragraph->Layout(300, txt::GetFontDir(), true); + } +} +BENCHMARK(BM_ParagraphShortLayout); + +static void BM_ParagraphLongLayout(benchmark::State& state) { + const char* text = + "This is a very long sentence to test if the text will properly wrap " + "around and go to the next line. Sometimes, short sentence. Longer " + "sentences are okay too because they are necessary. Very short. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " + "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " + "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate " + "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint " + "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + "mollit anim id est laborum. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " + "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " + "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate " + "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint " + "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + "mollit anim id est laborum."; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + + builder.PushStyle(text_style); + builder.AddText(u16_text); + builder.Pop(); + auto paragraph = builder.Build(); + while (state.KeepRunning()) { + paragraph->Layout(300, txt::GetFontDir(), true); + } +} +BENCHMARK(BM_ParagraphLongLayout); + +static void BM_ParagraphManyStylesLayout(benchmark::State& state) { + const char* text = "A short sentence. "; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + while (state.KeepRunning()) { + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + + for (int i = 0; i < 100; ++i) { + builder.PushStyle(text_style); + builder.AddText(u16_text); + } + auto paragraph = builder.Build(); + paragraph->Layout(300, txt::GetFontDir(), true); + } +} +BENCHMARK(BM_ParagraphManyStylesLayout); + +} // namespace txt diff --git a/engine/src/flutter/benchmarks/paragraph_builder_benchmarks.cc b/engine/src/flutter/benchmarks/paragraph_builder_benchmarks.cc new file mode 100644 index 0000000000..88da483736 --- /dev/null +++ b/engine/src/flutter/benchmarks/paragraph_builder_benchmarks.cc @@ -0,0 +1,194 @@ +/* + * Copyright 2017 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "third_party/benchmark/include/benchmark/benchmark_api.h" + +#include "lib/ftl/logging.h" +#include "lib/txt/src/font_style.h" +#include "lib/txt/src/font_weight.h" +#include "lib/txt/src/paragraph.h" +#include "lib/txt/src/paragraph_builder.h" +#include "lib/txt/src/text_align.h" +#include "third_party/icu/source/common/unicode/unistr.h" +#include "third_party/skia/include/core/SkColor.h" + +namespace txt { + +static void BM_ParagraphBuilderConstruction(benchmark::State& state) { + txt::ParagraphStyle paragraph_style; + while (state.KeepRunning()) { + txt::ParagraphBuilder builder(paragraph_style); + } +} +BENCHMARK(BM_ParagraphBuilderConstruction); + +static void BM_ParagraphBuilderPushStyle(benchmark::State& state) { + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + while (state.KeepRunning()) { + builder.PushStyle(text_style); + } +} +BENCHMARK(BM_ParagraphBuilderPushStyle); + +static void BM_ParagraphBuilderPushPop(benchmark::State& state) { + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + while (state.KeepRunning()) { + builder.PushStyle(text_style); + builder.Pop(); + } +} +BENCHMARK(BM_ParagraphBuilderPushPop); + +static void BM_ParagraphBuilderAddTextString(benchmark::State& state) { + std::string text = "Hello World"; + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + while (state.KeepRunning()) { + builder.AddText(text); + } +} +BENCHMARK(BM_ParagraphBuilderAddTextString); + +static void BM_ParagraphBuilderAddTextChar(benchmark::State& state) { + const char* text = "Hello World"; + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + while (state.KeepRunning()) { + builder.AddText(text); + } +} +BENCHMARK(BM_ParagraphBuilderAddTextChar); + +static void BM_ParagraphBuilderAddTextU16stringShort(benchmark::State& state) { + const char* text = "H"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + while (state.KeepRunning()) { + builder.AddText(u16_text); + } +} +BENCHMARK(BM_ParagraphBuilderAddTextU16stringShort); + +static void BM_ParagraphBuilderAddTextU16stringLong(benchmark::State& state) { + const char* text = + "This is a very long sentence to test if the text will properly wrap " + "around and go to the next line. Sometimes, short sentence. Longer " + "sentences are okay too because they are necessary. Very short. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " + "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " + "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate " + "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint " + "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + "mollit anim id est laborum. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " + "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " + "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate " + "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint " + "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + "mollit anim id est laborum."; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + while (state.KeepRunning()) { + builder.AddText(u16_text); + } +} +BENCHMARK(BM_ParagraphBuilderAddTextU16stringLong); + +static void BM_ParagraphBuilderShortParagraphConstruct( + benchmark::State& state) { + const char* text = "Hello World"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + + while (state.KeepRunning()) { + builder.PushStyle(text_style); + builder.AddText(u16_text); + builder.Pop(); + auto paragraph = builder.Build(); + } +} +BENCHMARK(BM_ParagraphBuilderShortParagraphConstruct); + +static void BM_ParagraphBuilderLongParagraphConstruct(benchmark::State& state) { + const char* text = + "This is a very long sentence to test if the text will properly wrap " + "around and go to the next line. Sometimes, short sentence. Longer " + "sentences are okay too because they are necessary. Very short. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " + "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " + "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate " + "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint " + "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + "mollit anim id est laborum. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " + "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " + "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate " + "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint " + "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + "mollit anim id est laborum."; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + + while (state.KeepRunning()) { + builder.PushStyle(text_style); + builder.AddText(u16_text); + builder.Pop(); + auto paragraph = builder.Build(); + } +} +BENCHMARK(BM_ParagraphBuilderLongParagraphConstruct); + +} // namespace txt diff --git a/engine/src/flutter/benchmarks/txt_run_all_benchmarks.cc b/engine/src/flutter/benchmarks/txt_run_all_benchmarks.cc new file mode 100644 index 0000000000..cc5bfc3645 --- /dev/null +++ b/engine/src/flutter/benchmarks/txt_run_all_benchmarks.cc @@ -0,0 +1,41 @@ +/* + * Copyright 2017 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "third_party/benchmark/include/benchmark/benchmark_api.h" + +#include "flutter/fml/icu_util.h" +#include "lib/ftl/logging.h" +#include "utils.h" + +// We will use a custom main to allow custom font directories for consistency. +int main(int argc, char** argv) { + ::benchmark::Initialize(&argc, argv); + ftl::CommandLine cmd = ftl::CommandLineFromArgcArgv(argc, argv); + txt::SetCommandLine(cmd); + std::string dir = txt::GetCommandLineForProcess().GetOptionValueWithDefault( + "font-directory", ""); + txt::SetFontDir(dir); + if (txt::GetFontDir().length() <= 0) { + FTL_LOG(ERROR) << "Font directory must be specified with " + "--font-directoy=\"\" to run this test."; + return EXIT_FAILURE; + } + FTL_DCHECK(txt::GetFontDir().length() > 0); + + fml::icu::InitializeICU(); + + ::benchmark::RunSpecifiedBenchmarks(); +} \ No newline at end of file diff --git a/engine/src/flutter/benchmarks/utils.cc b/engine/src/flutter/benchmarks/utils.cc new file mode 100644 index 0000000000..6ec90c2a5c --- /dev/null +++ b/engine/src/flutter/benchmarks/utils.cc @@ -0,0 +1,43 @@ +/* + * Copyright 2017 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "lib/ftl/command_line.h" +#include "lib/txt/tests/txt/utils.h" + +namespace txt { + +static std::string gFontDir; +static ftl::CommandLine gCommandLine; + +const std::string GetFontDir() { + return gFontDir; +} + +void SetFontDir(const std::string& dir) { + gFontDir = dir; +} + +const ftl::CommandLine& GetCommandLineForProcess() { + return gCommandLine; +} + +void SetCommandLine(ftl::CommandLine cmd) { + gCommandLine = std::move(cmd); +} + +} // namespace txt diff --git a/engine/src/flutter/benchmarks/utils.h b/engine/src/flutter/benchmarks/utils.h new file mode 100644 index 0000000000..5b6db12718 --- /dev/null +++ b/engine/src/flutter/benchmarks/utils.h @@ -0,0 +1,31 @@ +/* + * Copyright 2017 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "lib/ftl/command_line.h" + +namespace txt { + +const std::string GetFontDir(); + +void SetFontDir(const std::string& dir); + +const ftl::CommandLine& GetCommandLineForProcess(); + +void SetCommandLine(ftl::CommandLine cmd); + +} // namespace txt diff --git a/engine/src/flutter/src/paragraph.cc b/engine/src/flutter/src/paragraph.cc index dff8b5f449..0dda95b66a 100644 --- a/engine/src/flutter/src/paragraph.cc +++ b/engine/src/flutter/src/paragraph.cc @@ -140,10 +140,11 @@ void Paragraph::AddRunsToLineBreaker(const std::string& rootdir) { void Paragraph::Layout(double width, const std::string& rootdir, + bool force, const double x_offset, const double y_offset) { // Do not allow calling layout multiple times without changing anything. - if (!needs_layout_) + if (!needs_layout_ && !force) return; needs_layout_ = false; diff --git a/engine/src/flutter/src/paragraph.h b/engine/src/flutter/src/paragraph.h index f71b16be11..b4b90a4ee9 100644 --- a/engine/src/flutter/src/paragraph.h +++ b/engine/src/flutter/src/paragraph.h @@ -40,6 +40,7 @@ class Paragraph { void Layout(double width, const std::string& rootdir = "", + bool force = false, const double x_offset = 0.0, const double y_offset = 0.0); diff --git a/engine/src/flutter/tests/txt/utils.cc b/engine/src/flutter/tests/txt/utils.cc index 3f853b8a92..6ec90c2a5c 100644 --- a/engine/src/flutter/tests/txt/utils.cc +++ b/engine/src/flutter/tests/txt/utils.cc @@ -21,15 +21,15 @@ namespace txt { -static std::string gFontdir; +static std::string gFontDir; static ftl::CommandLine gCommandLine; const std::string GetFontDir() { - return gFontdir; + return gFontDir; } -void SetFontDir(std::string& dir) { - gFontdir = dir; +void SetFontDir(const std::string& dir) { + gFontDir = dir; } const ftl::CommandLine& GetCommandLineForProcess() { diff --git a/engine/src/flutter/tests/txt/utils.h b/engine/src/flutter/tests/txt/utils.h index ed42b82073..5b6db12718 100644 --- a/engine/src/flutter/tests/txt/utils.h +++ b/engine/src/flutter/tests/txt/utils.h @@ -22,7 +22,7 @@ namespace txt { const std::string GetFontDir(); -void SetFontDir(std::string& dir); +void SetFontDir(const std::string& dir); const ftl::CommandLine& GetCommandLineForProcess();