\doxysection{performance\+\_\+hint.\+hpp}
\hypertarget{performance__hint_8hpp_source}{}\label{performance__hint_8hpp_source}\index{ginkgo/core/log/performance\_hint.hpp@{ginkgo/core/log/performance\_hint.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2024\ The\ Ginkgo\ authors}}
\DoxyCodeLine{00002\ \textcolor{comment}{//}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ SPDX-\/License-\/Identifier:\ BSD-\/3-\/Clause}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#ifndef\ GKO\_PUBLIC\_CORE\_LOG\_PERFORMANCE\_HINT\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_LOG\_PERFORMANCE\_HINT\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <fstream>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <iostream>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <unordered\_map>}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <ginkgo/core/log/logger.hpp>}}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00017\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko_1_1log}{log}}\ \{}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00029\ \textcolor{keyword}{class\ }PerformanceHint\ :\ \textcolor{keyword}{public}\ Logger\ \{}
\DoxyCodeLine{00030\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00031\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1log_1_1PerformanceHint_aa3bd3b91c24a67ea52350f1ebcfe43ff}{on\_allocation\_completed}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1Executor}{Executor}}*\ exec,}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\&\ num\_bytes,}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{namespacegko_a70648f1299a0c1297e2bf86f47264626}{uintptr}}\&\ location)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1log_1_1PerformanceHint_a620e8a379028087ef250cc6f9cb87e74}{on\_free\_completed}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1Executor}{Executor}}*\ exec,}
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{namespacegko_a70648f1299a0c1297e2bf86f47264626}{uintptr}}\&\ location)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1log_1_1PerformanceHint_ac903d32fd9cc4cb6fa8265f9cf57c78a}{on\_copy\_completed}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1Executor}{Executor}}*\ from,\ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1Executor}{Executor}}*\ to,}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{namespacegko_a70648f1299a0c1297e2bf86f47264626}{uintptr}}\&\ location\_from,}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{namespacegko_a70648f1299a0c1297e2bf86f47264626}{uintptr}}\&\ location\_to,}
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\&\ num\_bytes)\ \textcolor{keyword}{const\ override};}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1log_1_1PerformanceHint_a5570eaac4f55d6a84293f4611c790f2c}{print\_status}}()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00061\ \ \ \ \ \textcolor{keyword}{static}\ std::unique\_ptr<PerformanceHint>\ \doxymbox{\hyperlink{classgko_1_1log_1_1PerformanceHint_ac57a0a98f2a0320d01805724abbd2249}{create}}(}
\DoxyCodeLine{00062\ \ \ \ \ \ \ \ \ std::ostream\&\ os\ =\ std::cerr,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ allocation\_size\_limit\ =\ 16,}
\DoxyCodeLine{00063\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ copy\_size\_limit\ =\ 16,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ histogram\_max\_size\ =\ 1024)}
\DoxyCodeLine{00064\ \ \ \ \ \{}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ std::unique\_ptr<PerformanceHint>(\textcolor{keyword}{new}\ PerformanceHint(}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \ \ \ \ os,\ allocation\_size\_limit,\ copy\_size\_limit,\ histogram\_max\_size));}
\DoxyCodeLine{00067\ \ \ \ \ \}}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keyword}{explicit}\ \doxymbox{\hyperlink{classgko_1_1log_1_1PerformanceHint}{PerformanceHint}}(std::ostream\&\ os,\ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ allocation\_size\_limit,}
\DoxyCodeLine{00071\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ copy\_size\_limit,}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ histogram\_max\_size)}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ :\ \doxymbox{\hyperlink{classgko_1_1log_1_1Logger}{Logger}}(mask\_),}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \ \ os\_(\&os),}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \ \ allocation\_size\_limit\_\{allocation\_size\_limit\},}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \ \ copy\_size\_limit\_\{copy\_size\_limit\},}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \ \ histogram\_max\_size\_\{histogram\_max\_size\}}
\DoxyCodeLine{00078\ \ \ \ \ \{\}}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{comment}{//\ set\ a\ breakpoint\ here\ if\ you\ want\ to\ see\ where\ the\ output\ comes\ from!}}
\DoxyCodeLine{00082\ \ \ \ \ std::ostream\&\ \doxymbox{\hyperlink{namespacegko_1_1log}{log}}()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ \ \ \ \ std::ostream*\ os\_;}
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keyword}{mutable}\ std::unordered\_map<uintptr\_t,\ size\_type>\ allocation\_sizes\_;}
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keyword}{mutable}\ std::unordered\_map<size\_type,\ int>\ allocation\_histogram\_;}
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keyword}{mutable}\ std::unordered\_map<uintptr\_t,\ int>\ copy\_src\_histogram\_;}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keyword}{mutable}\ std::unordered\_map<uintptr\_t,\ int>\ copy\_dst\_histogram\_;}
\DoxyCodeLine{00089\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ allocation\_size\_limit\_;}
\DoxyCodeLine{00090\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ copy\_size\_limit\_;}
\DoxyCodeLine{00091\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_a9579c98b1d85bf4ad02d7cb5b96fc771}{size\_type}}\ histogram\_max\_size\_;}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ Logger::mask\_type\ mask\_\ =}
\DoxyCodeLine{00093\ \ \ \ \ \ \ \ \ Logger::allocation\_completed\_mask\ |\ Logger::free\_completed\_mask\ |}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ Logger::copy\_completed\_mask;}
\DoxyCodeLine{00095\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ prefix\_\ =\ \textcolor{stringliteral}{"{}[PERFORMANCE]\ >>>\ "{}};}
\DoxyCodeLine{00096\ \};}
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00099\ \}\ \ \textcolor{comment}{//\ namespace\ log}}
\DoxyCodeLine{00100\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_LOG\_PERFORMANCE\_HINT\_HPP\_}}

\end{DoxyCode}
