In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Introduction of SylixOS debugging method
SylixOS implements a powerful debugging stub (pile), which can debug applications online on a device or simulator. RealEvo-IDE also provides supporting debugging plug-ins. At present, RealEvo-IDE not only supports automatic push debugging, but also supports the traditional debugging mode of starting gdbserver manually. There is no detailed description of several debugging methods which are very practical in daily development in the official user manual. This paper mainly introduces the debugging methods of performance analysis.
In the daily development process, we often encounter the situation that the program is not fast enough, but we do not know where it is slow. We often look for function optimization at random, and there is a great chance that the program is not really located where it is slow. Performance analysis tool is to use dynamic sampling to locate the real slow position, and then optimize at this point after positioning, the final program running time comparison is very obvious.
2. SylixOS performance analysis debugging steps 2.1.1 performance analysis demonstration demo
The performance analysis of SylixOS is mainly by loading the performance analysis module (sperfs.ko) to see the CPU time consumed by each function, and can accurately find the points that need to be optimized. The following is a demonstration of performance analysis and debugging by creating a "perfoms_check_app". The code is shown in listing 21.
Program listing 21 static_check_app code
/ / sperfstart sperfs
# include
# define USE_SLEEP
Void module_sleep (int iSecond)
{
# ifdef USE_SLEEP
Sleep (1)
# else
BspDelayUs (iSecond*1000*1000)
# endif
}
Void calc_value (void)
{
Static int i
ITunes +
}
Void do_something (void)
{
/ *
* do something
, /
Calc_value ()
Module_sleep (1)
}
Int main (int argc, char * * argv)
{
While (1) {
/ / do_something ()
}
Return (0)
}
2.1.2 load performance Analysis Module (sperfs.ko)
(the sperfs.ko module provides a debugging tool for SylixOS performance analysis and inspection)
Click "Device" in the upper right corner of the IDE interface; select the target machine IP address, here is the IP address of the virtual machine: 192.168.7.32, right-click the IP number to open "Launch FTP" for transfer; then find the sperfs.ko module in the local folder, and the transfer path is selected in the "/ lib/modules" directory; finally, double-click sperfs.ko to complete the preparation for module loading, as shown in figure 21.
Figure 21 method 1 of loading sperfs.ko module
In addition to the above methods, the performance analysis module can also be copied in the "/ lib/modules" directory through the "cp" instruction, as shown in figure 22.
Fig. 22 method II of loading sperfs.ko module
When finished, use "ls" under the "cd / lib/modules" directory to see if the copy is complete, and the result is shown in figure 22.
Figure 23 to see if loading is complete
Then change the permissions of the file through "chmod", and then register the performance analysis module with the "modulereg" command, as shown in figure 23.
Figure 24 registering kernel modules
Finally, use the "sperfstart" command to turn on the performance analysis function, and then use the "sperfs" command to view the performance analysis results, as shown in figure 24.
Figure 25 turns on the performance analysis module
In addition, we open a debugging window through Talnet and run the demo program "perfoms_check_app". The performance analysis results are shown in figure 25. In addition to idle threads t_idleo and sperfs.ko, the function that consumes the most CPU time is the main function in performs_check, where you only need to optimize this function to reduce the running time of the program.
Figure 26 results of performance analysis
Optimize the function, and the optimization result is shown in listing 22.
Listing 22 main function optimization result
Int main (int argc, char * * argv)
{
While (1) {
Do_something ()
}
Return (0)
}
Again, the performance analysis shows that, as shown in figure 26, the CPU time consumed by the main function has been greatly reduced.
Figure 27 results of performance analysis after optimization
3. Summary
A variety of debugging methods can be used in SylixOS to debug the program according to the actual situation. This section mainly introduces the performance analysis and inspection tools. The next document describes a variety of debugging methods through a complete project file.
4. references
SylixOS Application Development Manual
RealEvo-IDE user Manual
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.