当前位置:网站首页>B_ QuRT_ User_ Guide(37)
B_ QuRT_ User_ Guide(37)
2022-07-07 23:26:00 【weixin_ thirty-eight million four hundred and ninety-eight thou】
B_QuRT_User_Guide(37)
- 23 Profiling
- 23.1 qurt_get_core_pcycles()
- 23.2 qurt_atomic_compare_and_set()
- 23.3 qurt_profile_enable2()
- 23.4 qurt_profile_get()
- 23.5 qurt_profile_get_idle_pcycles()
- 23.6 qurt_profile_get_thread_pcycles()
- 23.7 qurt_get_hthread_pcycles()
- 23.8 qurt_get_hthread_commits()
- 23.9 qurt_profile_get_threadid_pcycles()
- 23.10 qurt_profile_reset_idle_pcycles()
- 23.11 qurt_profile_reset_threadid_pcycles()
- 23.12 Data Types
- 23 Macros
23 Profiling
Threads use profiling to determine the number of cycles in selected parts of a user program . Use the collected data to determine a QuRT Threads ( Or the whole QuRT User program system ) Of CPU utilization .
Profiling supports running ( perform ) And leisure ( Don't execute ) The specific thread loop count of the cycle . Reset count can count the cycle of a specific part of the user program .
In addition to a profile cycle count , All cycle counts are based on processor cycles ( The actual number of processor cycles executed by all hardware threads ) Express , Not thread cycles ( for example , The number of cycles executed by a specific hardware thread ). Suppose there are six hardware threads , The following equation expresses the relationship between these two cycle types .
Thread cycle = Processor cycles /6
Enable profiling optionally enables or disables profiling ( Disabled by default ).
Be careful : Resetting the cycle count must be done explicitly by calling the reset operation before starting the cycle count .
Get profiling thread ID The processor cycle operation returns the specified QuRT The current count of running cycles per hardware thread of the thread ( The first 3 section ). This operation returns an array containing the current running cycle count of each hardware thread . Each count value represents the number of processor cycles that have passed on the corresponding hardware thread , And the thread has been scheduled to the specified QuRT Threads .
Get the configuration file thread processor cycle operation returns the specified QuRT The current running cycle count of the thread ( The first 3 section ). The count value represents the number of processor cycles that have passed on all hardware threads , At the same time, the thread has been scheduled to the specified QuRT Threads .
Be careful : The count value is equivalent to the thread that will get the configuration file ID The cycle count value of each hardware thread returned by the processor cycle operation is added .
get profile thread cycles Operation returns to the current QuRT The current running cycle count of the thread , Expressed in thread cycles .
get profile idle processor cycles The operation returns the current number of idle cycles ( namely , A hardware thread is in IDLE The number of cycles in which the state does not execute any instructions ). This operation returns an array containing the current number of idle cycles of each hardware thread . Each count value represents the number of processor cycles that have passed in the wait mode of the corresponding hardware thread .
Be careful : The cycle executed in the kernel is based on the state of the current thread when it transitions to the kernel ( for example , Idle or running ) To be divided into idle or running .
Get core processor cycle operation returned from Hexagon The number of processor cycles executed since the processor was last reset . This value is based on the hardware core clock , Its speed varies according to the processor clock frequency ( With the first 16 The system clock described in section is different .
In a given period of time , The number of cycles passed by this operation is related to the thread of getting the configuration file / Idle processor cycle operation ( Are described above ) The relationship between the returned values is expressed by the following formula :
total_PCYCLES = run_pcycles + idle_pcycles
In this formula , Get core processor cycle operation return total_PCYCLES value .
run_pcycles and idle_pcycles Is based on getting the profile thread / The cycle value returned by the idle processor cycle operation is defined :
for (<all QuRT threads>) for (i = 0; i < MAX_HW_THREADS; i++) run_pcycles += profile_thread_pcycles[i] / 6;
for (i = 0; i < MAX_HW_THREADS; i++)
idle_pcycles += profile_idle_pcycles[i] / 6;
The loop count is summarized on a per thread basis , Therefore, the above code must convert each processor cycle count to thread cycle count ( By dividing by 6).
Be careful : When Hexagon When the processor is turned off , The hardware core clock stops running ( Because all its hardware threads are idle ), Treat the periodic value returned by this operation as a relative value rather than an absolute value .
Calculation CPU utilization - QuRT Threads ( Or the whole QuRT Application system ) Of CPU Utilization indicates , Within a certain period of time ,Hexagon How many cycles of processor execution are executed by specific threads ( Or application system ) Use :
CPU_utilization = run_pcycles / total_PCYCLES
In this equation ,run_pcycles Is the cycle count value returned by the get profile thread processor cycle operation .
total_PCYCLES It is operated by getting the cycle of the core processor ( Also described above ) The value returned .
Hexagon The processor may have spent some specified time in energy-saving mode , The hardware core clock is completely turned off ( Because all hardware threads are idle ). under these circumstances ,total_PCYCLES The value in does not represent absolute time .
In order to accurately calculate the CPU utilization , Turn off time adjustment with the core clock total_PCYCLES. Use the following formula to calculate QuRT Shutdown time of the system clock ( Also called ALL_WAIT period ):
ALL_WAIT_pcycles = ((total_sclk_samples / QTIMER_clock_freq)*
core_clock_freq) - total_PCYCLES
In this equation ,total_sclk_samples yes QuRT The number of cycles passed by the system clock ( The first 16 section ). total_PCYCLES By get core processor cycles The value returned by the operation .QTIMER_clock_freq by
On all target systems 19.2 MHz.
core_clock_freq yes Hexagon The core clock frequency of the processor ( Specific to each target system ). in consideration of ALL_WAIT period , Adjusted CPU The utilization rate is :
CPU_utilization = run_pcycles / (total_PCYCLES + ALL_WAIT_pcycles)
Be careful :ALL_WAIT_pcycles The equation assumes Hexagon The processor core clock frequency does not change within the analyzed time interval . If the clock frequency does change during this time interval , The input value must be corrected , Because the weight of each sample is different .
23.1 qurt_get_core_pcycles()
23.1.1 Function document
23.1.1.1 unsigned long long int qurt_get_core_pcycles ( void )
Get the count of core processor cycles executed .
Return from Hexagon The current number of running processor cycles executed since the processor was last reset .
This value is based on the hardware core clock , Its speed varies according to the clock frequency of the processor .
Subtract the atomic variable by one .
Be careful : Because the hardware core clock stops running when the processor is turned off ( Because all hardware threads are idle ), Please treat the periodic value returned by this operation as a relative value rather than an absolute value .
The number of thread cycles is only V4 Hexagon Valid in processor version .
Return value
Integer – Current count of core processor cycles.
Dependencies
None.
23.2 qurt_atomic_compare_and_set()
23.2 Function document
23.2.1.1 void qurt_profile_enable ( int enable )
Enable profiling .
Enable or disable cycle counting for running and idle processor cycles . By default , Profiling is disabled .
Be careful : Enabling profiling does not automatically reset the cycle count - This must be done explicitly by invoking the reset operation before starting the cycle count .
Parameters 
Return value
None.
Dependencies
None.
23.3 qurt_profile_enable2()
23.3.1 Function document
23.3.1.1 int qurt_profile_enable2 ( qurt_profile_param_t param, qurt_thread_t thread_id, int enable )
Start analyzing specific parameters on specific threads ( If applicable ).
** Parameters **
Return value
QURT_EOK – Success
QURT_EALREADY – Measurement already in progress or already stopped QURT_ENOTHREAD – Thread does not exist
QURT_EINVALID – Invalid profiling parameter
Dependencies
None.
23.4 qurt_profile_get()
23.4.1 Function document
23.4.1.1 int qurt_profile_get ( qurt_profile_param_t param, qurt_thread_t thread_id, qurt_profile_result_t ∗ result )
Get the value of the profiling parameter that was previously enabled .
Parameters 
Return value
QURT_EOK – Success
QURT_EFAILED – Operation failed; profiling was not enabled QURT_ENOTHREAD – Thread does not exist QURT_EINVALID – Invalid profiling parameter
Dependencies
None.
23.5 qurt_profile_get_idle_pcycles()
23.5.1 Function document
23.5.1.1 void qurt_profile_get_idle_pcycles ( unsigned long long ∗ pcycles )
Get the count of idle processor cycles .
Returns the current idle processor cycle count of all hardware threads .
This operation accepts a pointer to a user-defined array , And write the current idle cycle count of each hardware thread into the array .
Each count value represents the number of processor cycles that the corresponding hardware thread has passed in the wait mode .
Be careful : This operation does not return Hexagon Idle cycle that occurs when the processor is turned off ( Because all hardware threads are idle ).
Masked 64 Bitwise and operation of bitwise atomic variables .
Parameters 
Return value
None..
Dependencies
None.
23.6 qurt_profile_get_thread_pcycles()
23.6.1 Function document
23.6.1.1 unsigned long long int qurt_profile_get_thread_pcycles
Get the count of processor cycles that the current thread is running .
Returns the current QuRT The number of processor cycles the thread is running .
Return value
Integer – Running processor cycle count for current thread.
Dependencies
None.
23.7 qurt_get_hthread_pcycles()
23.7.1 Function document
23.7.1.1 unsigned int qurt_get_hthread_pcycles ( int n )
Read GCYCLE_nT register , In order to be in N Measure performance when threads are in run mode .
Be careful : When the architecture is older than v67 When to return to 0.
Parameters 
Return value
Value read from GCYCLE_nT register.
Dependencies
PMU must be enabled.
23.8 qurt_get_hthread_commits()
23.8.1 Function document
23.8.1.1 unsigned int qurt_get_hthread_commits ( int n )
Read GCOMMIT_nT register , In order to be in N Performance measurement when threads are in running mode .
Be careful : When the architecture is older than v67 When to return to 0.
Parameters 
Return value
Value read from the GCOMMIT_nT register.
Dependencies
PMU must be enabled.
23.9 qurt_profile_get_threadid_pcycles()
23.9.1 Function document
23.9.1.1 void qurt_profile_get_threadid_pcycles ( int thread_id, unsigned long long ∗ pcycles )
Get specified QuRT The running processor cycle count of the thread .
Returns the specified QuRT The current running cycle count of each hardware thread of the thread .
Each count value represents the number of processor cycles that have passed on the corresponding hardware thread , And the thread has been scheduled to the specified QuRT Threads .
Parameters 
Return value
None.
Dependencies
None.
23.10 qurt_profile_reset_idle_pcycles()
23.10.1 Function document
23.10.1.1 void qurt_profile_reset_idle_pcycles ( void
Set the idle cycle count of each hardware thread to zero .
Return value
None.
Dependencies
None.
23.11 qurt_profile_reset_threadid_pcycles()
23.11.1 Function document
23.11.1.1 void qurt_profile_reset_threadid_pcycles ( int thread_id )
Specifies the QuRT The run cycle count of each hardware thread of the thread is set to zero .
Parameters 
Return value
None.
Dependencies
None.
23.12 Data Types
This section describes the data types of profiling Services .
23.12.1 Data Structure Documentation
23.12.1.1 union qurt_profile_result_t
Analysis results .
23.12.1.2 struct qurt_profile_result_t.thread_ready_time
And QURT_PROFILE_PARAM_THREAD_READY_TIME Relevant results .
23 Macros
This section describes the macros used to profile Services .
23.13 Define Documentation
23.13.1 Function document
23.13.1.1 static QURT_INLINE unsigned long long qurt_atomic64_sub_return (unsigned long long ∗ target, unsigned long long v )
Disable profiling .
23.13.1.2 #define QURT_PROFILE_ENABLE 1
Disable profiling .
23.13.2 Enumeration Type Documentation
23.13.2.1 enum qurt_profile_param_t
Enumerator :
QURT_PROFILE_PARAM_THREAD_READY_TIME Outline thread preparation time .
边栏推荐
- 2022 届的应届生都找到工作了吗?做自媒体可以吗?
- [compilation principle] lexical analysis design and Implementation
- First week of July
- STL标准模板库(Standard Template Library)一周学习总结
- LDO穩壓芯片-內部框圖及選型參數
- 海内外技术人们“看”音视频技术的未来
- 电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
- Conversion between commonsmultipartfile and file
- B_QuRT_User_Guide(36)
- The text editor of markdown class should add colors to fonts (including typora, CSDN, etc.)
猜你喜欢

Spark 离线开发框架设计与实现

在软件工程领域,搞科研的这十年!

leetcode-520. Detect capital letters -js

When copying something from the USB flash disk, an error volume error is reported. Please run CHKDSK

First week of July
![给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」](/img/21/2e99dd6173ab4925ec22290cd4a357.png)
给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」

Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid

Explain

re1攻防世界逆向

建筑建材行业SRM供应商云协同管理平台解决方案,实现业务应用可扩展可配置
随机推荐
FreeLink开源呼叫中心设计思想
V-for traversal object
城联优品作为新力量初注入,相关上市公司股价应声上涨150%
UE4_ Ue5 combined with Logitech handle (F710) use record
PCB wiring rules of PCI Express interface
Network security sqlmap and DVWA explosion
Network security -beef
ROS2专题(03):ROS1和ROS2的区别【01】
ArcGIS: two methods of attribute fusion of the same field of vector elements
B_QuRT_User_Guide(40)
JS get the key and value of the object
云原生正在吞噬一切,开发者该如何应对?
UE4_UE5蓝图command节点的使用(开启关闭屏幕响应-log-发布全屏显示)
海内外技术人们“看”音视频技术的未来
leetcode-520. Detect capital letters -js
2022 届的应届生都找到工作了吗?做自媒体可以吗?
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
Unity3d learning notes 4 - create mesh advanced interface
系统设计概述
Mysql索引优化实战一