File tree Expand file tree Collapse file tree 3 files changed +56
-21
lines changed Expand file tree Collapse file tree 3 files changed +56
-21
lines changed Original file line number Diff line number Diff line change 1515#include " lib/Metadata/Finalize.hpp"
1616#include " lib/Lib/Lookup.hpp"
1717#include " lib/Support/Error.hpp"
18+ #include " lib/Support/Chrono.hpp"
1819#include < mrdocs/Metadata.hpp>
1920#include < mrdocs/Support/Error.hpp>
2021#include < llvm/ADT/STLExtras.h>
7879
7980// ------------------------------------------------
8081
81- namespace {
82- template <class Rep , class Period >
83- std::string
84- format_duration (
85- std::chrono::duration<Rep, Period> delta)
86- {
87- auto delta_ms = std::chrono::duration_cast<
88- std::chrono::milliseconds>(delta).count ();
89- if (delta_ms < 1000 )
90- {
91- return fmt::format (" {} ms" , delta_ms);
92- }
93- else
94- {
95- double const delta_s = static_cast <double >(delta_ms) / 1000.0 ;
96- return fmt::format (" {:.02f} s" , delta_s);
97- }
98- }
99- }
100-
10182mrdocs::Expected<std::unique_ptr<Corpus>>
10283CorpusImpl::
10384build (
Original file line number Diff line number Diff line change 1+ //
2+ // Licensed under the Apache License v2.0 with LLVM Exceptions.
3+ // See https://llvm.org/LICENSE.txt for license information.
4+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+ //
6+ // Copyright (c) 2023 Vinnie Falco ([email protected] )7+ // Copyright (c) 2023 Krystian Stasiowski ([email protected] )8+ // Copyright (c) 2024 Alan de Freitas ([email protected] )9+ //
10+ // Official repository: https://github.com/cppalliance/mrdocs
11+ //
12+
13+ #ifndef MRDOCS_LIB_SUPPORT_CHRONO_HPP
14+ #define MRDOCS_LIB_SUPPORT_CHRONO_HPP
15+
16+ #include < chrono>
17+ #include < string>
18+ #include < fmt/format.h>
19+
20+ namespace clang {
21+ namespace mrdocs {
22+
23+ template <class Rep , class Period >
24+ std::string
25+ format_duration (
26+ std::chrono::duration<Rep, Period> delta)
27+ {
28+ auto delta_ms = std::chrono::duration_cast<
29+ std::chrono::milliseconds>(delta).count ();
30+ if (delta_ms < 1000 )
31+ {
32+ return fmt::format (" {} ms" , delta_ms);
33+ }
34+ else
35+ {
36+ double const delta_s = static_cast <double >(delta_ms) / 1000.0 ;
37+ return fmt::format (" {:.02f} s" , delta_s);
38+ }
39+ }
40+
41+ } // mrdocs
42+ } // clang
43+
44+ #endif
Original file line number Diff line number Diff line change 1111
1212#include " lib/AST/ParseJavadoc.hpp"
1313#include " lib/Support/Path.hpp"
14+ #include " lib/Support/Chrono.hpp"
1415#include < mrdocs/Support/Error.hpp>
1516#include < mrdocs/Generator.hpp>
1617#include < llvm/ADT/SmallString.h>
@@ -58,11 +59,20 @@ Error
5859Generator::
5960build (Corpus const & corpus) const
6061{
62+ using clock_type = std::chrono::steady_clock;
63+ auto start_time = clock_type::now ();
6164 std::string absOutput = files::normalizePath (
6265 files::makeAbsolute (
6366 corpus.config ->output ,
6467 corpus.config ->configDir ));
65- return build (absOutput, corpus);
68+ auto err = build (absOutput, corpus);
69+ if (!err.failed ())
70+ {
71+ report::info (
72+ " Generated documentation in {}" ,
73+ format_duration (clock_type::now () - start_time));
74+ }
75+ return err;
6676}
6777
6878Error
You can’t perform that action at this time.
0 commit comments