\doxysubsubsection{Time measurement }
\hypertarget{group___b_e_n_c_h___t_i_m_e}{}\label{group___b_e_n_c_h___t_i_m_e}\index{Time measurement@{Time measurement}}


Библиотека для измерения времени/тиков между событиями  


Collaboration diagram for Time measurement\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=286pt]{group___b_e_n_c_h___t_i_m_e}
\end{center}
\end{figure}
\doxysubsubsubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_ga31b9f2267c562f3ceb533606daf0b789}{Bench\+Time\+\_\+\+Init}}()
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_ga89ff6c06fc21fb2bbfbf8cbf863316f1}{Bench\+Time\+\_\+\+Start}}(channel,  ticks,  tick\+\_\+period)
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_gadddc120d43a10fad50fbdeeab8d086b5}{Bench\+Time\+\_\+\+End}}(channel,  ticks)
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_ga91e352219014c7ea5507bbbe4b15912d}{Bench\+Time\+\_\+\+Get\+Min}}(channel)
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_gab8103362e89bad95d965ac668284065c}{Bench\+Time\+\_\+\+Get\+Max}}(channel)
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_ga9f82f5ed8cfae31292dc3dca41471dd5}{Bench\+Time\+\_\+\+Get\+Average}}(channel)
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_gaafbca7155cfc97b68428da2b0b1200ef}{Bench\+Time\+\_\+\+Get\+Count}}(channel)
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_ga9911aa13a8fa67c35a261d1cb3dc11e7}{Bench\+Time\+\_\+\+Get\+Last}}(channel)
\item 
\#define \mbox{\hyperlink{group___b_e_n_c_h___t_i_m_e_ga09b9a6ef9b60605fc0015f6b379d8420}{Bench\+Time\+\_\+\+Reset\+Stats}}(channel)
\end{DoxyCompactItemize}


\doxysubsubsubsection{Detailed Description}
Библиотека для измерения времени/тиков между событиями 

Поддерживает\+:
\begin{DoxyItemize}
\item Многоканальные измерения (несколько независимых таймеров)
\item Платформонезависимый интерфейс
\item Измерение в тиках или временных единицах
\item Статистику измерений (мин/макс/среднее)
\item Настраиваемый размер тиков для каждого канала
\end{DoxyItemize}

Параметры для конфигурации\+:
\begin{DoxyItemize}
\item \doxylink{group___g_e_n___c_o_n_f_i_g_ga67c3c54503b9bbd5d175ac46d37866d9}{BENCH\+\_\+\+TIME\+\_\+\+ENABLE} -\/ Включить бенч времени
\item \doxylink{group___g_e_n___c_o_n_f_i_g_ga74fdf777ceefa5e7d67120fbda4cde52}{BENCH\+\_\+\+TIME\+\_\+\+MAX\+\_\+\+CHANNELS} -\/ Максимальное количество каналов измерения (по умолчанию 8)
\end{DoxyItemize}

\begin{DoxyParagraph}{Пример использования\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{bench__time_8h}{bench\_time.h}}"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Инициализация}}
\DoxyCodeLine{BenchTime\_Init();}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Измерение\ с\ SysTick}}
\DoxyCodeLine{BenchTime\_Start(0,\ HAL\_GetTick,\ 0xFFFFFFFF);}
\DoxyCodeLine{some\_function();}
\DoxyCodeLine{uint32\_t\ time\ =\ BenchTime\_End(0,\ HAL\_GetTick);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Измерение\ с\ TIM2\ (16-\/бит)}}
\DoxyCodeLine{BenchTime\_Start(1,\ TIM2-\/>CNT,\ 0xFFFF);}
\DoxyCodeLine{fast\_function();\ }
\DoxyCodeLine{uint32\_t\ time2\ =\ BenchTime\_End(1,\ TIM2-\/>CNT);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Измерение\ с\ DWT\ цикловым\ счетчиком}}
\DoxyCodeLine{BenchTime\_Start(2,\ DWT-\/>CYCCNT,\ 0xFFFFFFFF);}
\DoxyCodeLine{critical\_function();}
\DoxyCodeLine{uint32\_t\ cycles\ =\ BenchTime\_End(2,\ DWT-\/>CYCCNT);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Многоканальное\ измерение}}
\DoxyCodeLine{BenchTime\_Start(0,\ HAL\_GetTick,\ 1000);\ \ \ \ \ \ \ \ \textcolor{comment}{//\ общее\ время}}
\DoxyCodeLine{BenchTime\_Start(1,\ TIM3-\/>CNT,\ 500);\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ часть\ 1}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ ...\ код\ 1}}
\DoxyCodeLine{}
\DoxyCodeLine{uint32\_t\ part1\ =\ BenchTime\_End(1,\ TIM3-\/>CNT);}
\DoxyCodeLine{BenchTime\_Start(2,\ TIM4-\/>CNT,\ 200);\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ часть\ 2\ \ }}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ ...\ код\ 2}}
\DoxyCodeLine{}
\DoxyCodeLine{uint32\_t\ part2\ =\ BenchTime\_End(2,\ TIM4-\/>CNT);}
\DoxyCodeLine{uint32\_t\ total\ =\ BenchTime\_End(0,\ HAL\_GetTick);\ \textcolor{comment}{//\ общее\ время}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Статистика}}
\DoxyCodeLine{uint32\_t\ min\_time\ =\ BenchTime\_GetMin(0);}
\DoxyCodeLine{uint32\_t\ max\_time\ =\ BenchTime\_GetMax(0);}
\DoxyCodeLine{uint32\_t\ avg\_time\ =\ BenchTime\_GetAverage(0);}
\DoxyCodeLine{uint32\_t\ count\ =\ BenchTime\_GetCount(0);}

\end{DoxyCode}

\end{DoxyParagraph}


\label{doc-define-members}
\Hypertarget{group___b_e_n_c_h___t_i_m_e_doc-define-members}
\doxysubsubsubsection{Macro Definition Documentation}
\Hypertarget{group___b_e_n_c_h___t_i_m_e_ga31b9f2267c562f3ceb533606daf0b789}\index{Time measurement@{Time measurement}!BenchTime\_Init@{BenchTime\_Init}}
\index{BenchTime\_Init@{BenchTime\_Init}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_Init}{BenchTime\_Init}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_ga31b9f2267c562f3ceb533606daf0b789} 
\#define Bench\+Time\+\_\+\+Init(\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})}



Definition at line \mbox{\hyperlink{bench__time_8h_source_l00241}{241}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_ga89ff6c06fc21fb2bbfbf8cbf863316f1}\index{Time measurement@{Time measurement}!BenchTime\_Start@{BenchTime\_Start}}
\index{BenchTime\_Start@{BenchTime\_Start}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_Start}{BenchTime\_Start}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_ga89ff6c06fc21fb2bbfbf8cbf863316f1} 
\#define Bench\+Time\+\_\+\+Start(\begin{DoxyParamCaption}\item[{}]{channel}{, }\item[{}]{ticks}{, }\item[{}]{tick\+\_\+period}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{0}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{bench__time_8h_source_l00242}{242}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_gadddc120d43a10fad50fbdeeab8d086b5}\index{Time measurement@{Time measurement}!BenchTime\_End@{BenchTime\_End}}
\index{BenchTime\_End@{BenchTime\_End}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_End}{BenchTime\_End}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_gadddc120d43a10fad50fbdeeab8d086b5} 
\#define Bench\+Time\+\_\+\+End(\begin{DoxyParamCaption}\item[{}]{channel}{, }\item[{}]{ticks}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{0}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{bench__time_8h_source_l00243}{243}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_ga91e352219014c7ea5507bbbe4b15912d}\index{Time measurement@{Time measurement}!BenchTime\_GetMin@{BenchTime\_GetMin}}
\index{BenchTime\_GetMin@{BenchTime\_GetMin}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_GetMin}{BenchTime\_GetMin}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_ga91e352219014c7ea5507bbbe4b15912d} 
\#define Bench\+Time\+\_\+\+Get\+Min(\begin{DoxyParamCaption}\item[{}]{channel}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{0}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{bench__time_8h_source_l00244}{244}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_gab8103362e89bad95d965ac668284065c}\index{Time measurement@{Time measurement}!BenchTime\_GetMax@{BenchTime\_GetMax}}
\index{BenchTime\_GetMax@{BenchTime\_GetMax}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_GetMax}{BenchTime\_GetMax}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_gab8103362e89bad95d965ac668284065c} 
\#define Bench\+Time\+\_\+\+Get\+Max(\begin{DoxyParamCaption}\item[{}]{channel}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{0}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{bench__time_8h_source_l00245}{245}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_ga9f82f5ed8cfae31292dc3dca41471dd5}\index{Time measurement@{Time measurement}!BenchTime\_GetAverage@{BenchTime\_GetAverage}}
\index{BenchTime\_GetAverage@{BenchTime\_GetAverage}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_GetAverage}{BenchTime\_GetAverage}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_ga9f82f5ed8cfae31292dc3dca41471dd5} 
\#define Bench\+Time\+\_\+\+Get\+Average(\begin{DoxyParamCaption}\item[{}]{channel}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{0}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{bench__time_8h_source_l00246}{246}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_gaafbca7155cfc97b68428da2b0b1200ef}\index{Time measurement@{Time measurement}!BenchTime\_GetCount@{BenchTime\_GetCount}}
\index{BenchTime\_GetCount@{BenchTime\_GetCount}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_GetCount}{BenchTime\_GetCount}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_gaafbca7155cfc97b68428da2b0b1200ef} 
\#define Bench\+Time\+\_\+\+Get\+Count(\begin{DoxyParamCaption}\item[{}]{channel}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{0}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{bench__time_8h_source_l00247}{247}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_ga9911aa13a8fa67c35a261d1cb3dc11e7}\index{Time measurement@{Time measurement}!BenchTime\_GetLast@{BenchTime\_GetLast}}
\index{BenchTime\_GetLast@{BenchTime\_GetLast}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_GetLast}{BenchTime\_GetLast}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_ga9911aa13a8fa67c35a261d1cb3dc11e7} 
\#define Bench\+Time\+\_\+\+Get\+Last(\begin{DoxyParamCaption}\item[{}]{channel}{}\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{0}

\end{DoxyCode}


Definition at line \mbox{\hyperlink{bench__time_8h_source_l00248}{248}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

\Hypertarget{group___b_e_n_c_h___t_i_m_e_ga09b9a6ef9b60605fc0015f6b379d8420}\index{Time measurement@{Time measurement}!BenchTime\_ResetStats@{BenchTime\_ResetStats}}
\index{BenchTime\_ResetStats@{BenchTime\_ResetStats}!Time measurement@{Time measurement}}
\doxysubsubsubsubsection{\texorpdfstring{BenchTime\_ResetStats}{BenchTime\_ResetStats}}
{\footnotesize\ttfamily \label{group___b_e_n_c_h___t_i_m_e_ga09b9a6ef9b60605fc0015f6b379d8420} 
\#define Bench\+Time\+\_\+\+Reset\+Stats(\begin{DoxyParamCaption}\item[{}]{channel}{}\end{DoxyParamCaption})}



Definition at line \mbox{\hyperlink{bench__time_8h_source_l00249}{249}} of file \mbox{\hyperlink{bench__time_8h_source}{bench\+\_\+time.\+h}}.

