性能测试工具一——gprof

devtools/2024/9/23 9:35:47/

gprof只适用于Linux平台,不支持MacOS和Windows。

使用前提:在编译指令中加入-pg即可。也可添加其它编译选项,但-pg是核心,-Og -g -pg-D NDEBUG -Og -g -pg

例如在Makefileg++ -Og -g -pg。或在CMakeLists.txtset(CMAKE_CXX_FLAGS"-D NDEBUG -Og -g -pg")
实测发现不管是Debug模式还是Release模式都可以生成性能统计文件gmon.out

可以看到优化选项只能开到Og,这也是gprof的缺点。

Step1:编译得到可执行程序a.out,也可以带参数;
Step2:执行可执行程序a.out,如有需要则加上可执行程序的参数,此步会生成性能统计文件gmon.out
Step3gprof a.out gmon.out > gprof.out
Step4:查看gprof.out文件即可获得详细的耗时结果,使用notepad++直接打开即可,或使用vim -c ‘set nowrap’ gprof.out查看。

Reference

GPROF Tutorial – How to use Linux GNU GCC Profiling Tool

如下是一个gprof.out示例:

Flat profile:Each sample counts as 0.01 seconds.%   cumulative   self              self     total           time   seconds   seconds    calls  Ts/call  Ts/call  name    
100.00      0.01     0.01                             _init0.00      0.01     0.00   100002     0.00     0.00  batchMeasureClockOverhead()0.00      0.01     0.00   100002     0.00     0.00  pf::Profile::getInstance()0.00      0.01     0.00   100000     0.00     0.00  singleMeasureClockOverhead()0.00      0.01     0.00        2     0.00     0.00  void std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> >::_M_realloc_insert<pf::ProfileInfo>(__gnu_cxx::__normal_iterator<pf::ProfileInfo*, std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> > >, pf::ProfileInfo&&)0.00      0.01     0.00        2     0.00     0.00  void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag)0.00      0.01     0.00        1     0.00     0.00  __static_initialization_and_destruction_0(int, int)0.00      0.01     0.00        1     0.00     0.00  pf::doProfileRegister(std::basic_string_view<char, std::char_traits<char> >)0.00      0.01     0.00        1     0.00     0.00  pf::Profile::~Profile()0.00      0.01     0.00        1     0.00     0.00  void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)0.00      0.01     0.00        1     0.00     0.00  std::_Rb_tree_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert_<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node&)0.00      0.01     0.00        1     0.00     0.00  std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)%         the percentage of the total running time of the
time       program used by this function.cumulative a running sum of the number of seconds accountedseconds   for by this function and those listed above it.self      the number of seconds accounted for by this
seconds    function alone.  This is the major sort for thislisting.calls      the number of times this function was invoked, ifthis function is profiled, else blank.self      the average number of milliseconds spent in this
ms/call    function per call, if this function is profiled,else blank.total     the average number of milliseconds spent in this
ms/call    function and its descendents per call, if thisfunction is profiled, else blank.name       the name of the function.  This is the minor sortfor this listing. The index shows the location ofthe function in the gprof listing. If the index isin parenthesis it shows where it would appear inthe gprof listing if it were to be printed.Copyright (C) 2012-2022 Free Software Foundation, Inc.Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.Call graph (explanation follows)granularity: each sample hit covers 4 byte(s) for 100.00% of 0.01 secondsindex % time    self  children    called     name<spontaneous>
[1]    100.0    0.01    0.00                 _init [1]
-----------------------------------------------100000             batchMeasureClockOverhead() [10]0.00    0.00       2/100002      _GLOBAL__sub_I_mutex [22]0.00    0.00  100000/100002      singleMeasureClockOverhead() [12]
[10]     0.0    0.00    0.00  100002+100000  batchMeasureClockOverhead() [10]0.00    0.00       1/1           pf::doProfileRegister(std::basic_string_view<char, std::char_traits<char> >) [16]100000             batchMeasureClockOverhead() [10]
-----------------------------------------------0.00    0.00       1/100002      pf::doProfileRegister(std::basic_string_view<char, std::char_traits<char> >) [16]0.00    0.00       1/100002      pf::Profile::~Profile() [17]0.00    0.00  100000/100002      singleMeasureClockOverhead() [12]
[11]     0.0    0.00    0.00  100002         pf::Profile::getInstance() [11]0.00    0.00       1/1           __static_initialization_and_destruction_0(int, int) [15]
-----------------------------------------------0.00    0.00  100000/100000      __static_initialization_and_destruction_0(int, int) [24]
[12]     0.0    0.00    0.00  100000         singleMeasureClockOverhead() [12]0.00    0.00  100000/100002      batchMeasureClockOverhead() [10]0.00    0.00  100000/100002      pf::Profile::getInstance() [11]
-----------------------------------------------0.00    0.00       1/2           pf::doProfileRegister(std::basic_string_view<char, std::char_traits<char> >) [16]0.00    0.00       1/2           void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) [14]
[13]     0.0    0.00    0.00       2         void std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> >::_M_realloc_insert<pf::ProfileInfo>(__gnu_cxx::__normal_iterator<pf::ProfileInfo*, std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> > >, pf::ProfileInfo&&) [13]0.00    0.00       1/1           std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [20]0.00    0.00       1/1           std::_Rb_tree_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert_<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node&) [19]
-----------------------------------------------0.00    0.00       1/2           pf::doProfileRegister(std::basic_string_view<char, std::char_traits<char> >) [16]0.00    0.00       1/2           _GLOBAL__sub_I__ZN2pf7Profile11getInstanceEv [21]
[14]     0.0    0.00    0.00       2         void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) [14]0.00    0.00       1/2           void std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> >::_M_realloc_insert<pf::ProfileInfo>(__gnu_cxx::__normal_iterator<pf::ProfileInfo*, std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> > >, pf::ProfileInfo&&) [13]
-----------------------------------------------0.00    0.00       1/1           pf::Profile::getInstance() [11]
[15]     0.0    0.00    0.00       1         __static_initialization_and_destruction_0(int, int) [15]
-----------------------------------------------0.00    0.00       1/1           batchMeasureClockOverhead() [10]
[16]     0.0    0.00    0.00       1         pf::doProfileRegister(std::basic_string_view<char, std::char_traits<char> >) [16]0.00    0.00       1/100002      pf::Profile::getInstance() [11]0.00    0.00       1/2           void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) [14]0.00    0.00       1/2           void std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> >::_M_realloc_insert<pf::ProfileInfo>(__gnu_cxx::__normal_iterator<pf::ProfileInfo*, std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> > >, pf::ProfileInfo&&) [13]
-----------------------------------------------1             pf::Profile::~Profile() [17]0.00    0.00       1/1           std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [20]
[17]     0.0    0.00    0.00       1+1       pf::Profile::~Profile() [17]0.00    0.00       1/100002      pf::Profile::getInstance() [11]1             pf::Profile::~Profile() [17]
-----------------------------------------------0.00    0.00       1/1           _GLOBAL__sub_I__ZN2pf7Profile11getInstanceEv [21]
[18]     0.0    0.00    0.00       1         void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [18]
-----------------------------------------------0.00    0.00       1/1           void std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> >::_M_realloc_insert<pf::ProfileInfo>(__gnu_cxx::__normal_iterator<pf::ProfileInfo*, std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> > >, pf::ProfileInfo&&) [13]
[19]     0.0    0.00    0.00       1         std::_Rb_tree_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert_<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node&) [19]
-----------------------------------------------0.00    0.00       1/1           void std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> >::_M_realloc_insert<pf::ProfileInfo>(__gnu_cxx::__normal_iterator<pf::ProfileInfo*, std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> > >, pf::ProfileInfo&&) [13]
[20]     0.0    0.00    0.00       1         std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [20]0.00    0.00       1/1           pf::Profile::~Profile() [17]
-----------------------------------------------This table describes the call tree of the program, and was sorted bythe total amount of time spent in each function and its children.Each entry in this table consists of several lines.  The line with theindex number at the left hand margin lists the current function.The lines above it list the functions that called this function,and the lines below it list the functions this one called.This line lists:index	A unique number given to each element of the table.Index numbers are sorted numerically.The index number is printed next to every function name soit is easier to look up where the function is in the table.% time	This is the percentage of the `total' time that was spentin this function and its children.  Note that due todifferent viewpoints, functions excluded by options, etc,these numbers will NOT add up to 100%.self	This is the total amount of time spent in this function.children	This is the total amount of time propagated into thisfunction by its children.called	This is the number of times the function was called.If the function called itself recursively, the numberonly includes non-recursive calls, and is followed bya `+' and the number of recursive calls.name	The name of the current function.  The index number isprinted after it.  If the function is a member of acycle, the cycle number is printed between thefunction's name and the index number.For the function's parents, the fields have the following meanings:self	This is the amount of time that was propagated directlyfrom the function into this parent.children	This is the amount of time that was propagated fromthe function's children into this parent.called	This is the number of times this parent called thefunction `/' the total number of times the functionwas called.  Recursive calls to the function are notincluded in the number after the `/'.name	This is the name of the parent.  The parent's indexnumber is printed after it.  If the parent is amember of a cycle, the cycle number is printed betweenthe name and the index number.If the parents of the function cannot be determined, the word`<spontaneous>' is printed in the `name' field, and all the otherfields are blank.For the function's children, the fields have the following meanings:self	This is the amount of time that was propagated directlyfrom the child into the function.children	This is the amount of time that was propagated from thechild's children to the function.called	This is the number of times the function calledthis child `/' the total number of times the childwas called.  Recursive calls by the child are notlisted in the number after the `/'.name	This is the name of the child.  The child's indexnumber is printed after it.  If the child is amember of a cycle, the cycle number is printedbetween the name and the index number.If there are any cycles (circles) in the call graph, there is anentry for the cycle-as-a-whole.  This entry shows who called thecycle (as parents) and the members of the cycle (as children.)The `+' recursive calls entry shows the number of function calls thatwere internal to the cycle, and the calls entry for each member shows,for that member, how many times it was called from other members ofthe cycle.Copyright (C) 2012-2022 Free Software Foundation, Inc.Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.Index by function name[10] batchMeasureClockOverhead() [11] pf::Profile::getInstance() [18] void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)[12] singleMeasureClockOverhead() [17] pf::Profile::~Profile() [19] std::_Rb_tree_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert_<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Alloc_node&)[15] __static_initialization_and_destruction_0(int, int) (main.cpp) [13] void std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> >::_M_realloc_insert<pf::ProfileInfo>(__gnu_cxx::__normal_iterator<pf::ProfileInfo*, std::vector<pf::ProfileInfo, std::allocator<pf::ProfileInfo> > >, pf::ProfileInfo&&) [20] std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)[16] pf::doProfileRegister(std::basic_string_view<char, std::char_traits<char> >) [14] void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) [1] _init

http://www.ppmy.cn/devtools/13405.html

相关文章

CSP初赛知识精讲--排列组合

第十一节 排列组合 基础知识 排列是指从给定个数的元素中取出指定个数的元素进行排序。  组合是指从给定个数的元素中仅仅取出指定元素个数的元素&#xff0c;不考虑排序。  排列组合问题的关键就是研究给定要求的排列和组合可能出现的情况的总数。 定义与公式  排列&…

轻量级SQLite可视化工具Sqliteviz

什么是 Sqliteviz &#xff1f; Sqliteviz 是一个单页面离线优先的渐进式网络应用&#xff08;PWA&#xff09;&#xff0c;用于完全客户端的 SQLite 数据库或 CSV 文件的可视化。 所谓完全客户端&#xff0c;就是您的数据库永远不会离开您的计算机。使用 sqliteviz&#xff0c…

【软件工程与实践】(第四版)第6章习题答案详解

第6章 一、填空题二、选择题三、简答题四、实践题 一、填空题 &#xff08;1&#xff09; 编程语言是人与计算机交流的 工具。 &#xff08;2&#xff09; 从语言层次上&#xff0c;编程语言可以分为 低级语言 和 高级语言 两种类型。 &#xff08;3&#xff09; 1960年代出现…

安卓手机APP开发__媒体开发部分__播放器的接口

安卓手机APP开发__媒体开发部分__播放器的接口 目录 概述 组件之间的共同的接口 媒体3的播放的架构 播放器的状态 对改变的监听 当前的播放 定制的播放器实现 概述 一个播放器是你的APP中完成媒体项的播放的组件. 媒体3的播放器接口提供了一个关于播放器处理的功能的总…

C++ day2

#include <iostream> using namespace std; class Rec {int length;int width; public:void set_length(int l); //设置长度void set_width(int w); //设置宽度int get_length(); //获取长度int get_width(); //获取宽度void show(); //输出周长和…

力扣HOT100 - 148. 排序链表

解题思路&#xff1a; 归并排序 class Solution {public ListNode sortList(ListNode head) {if (head null || head.next null) return head;ListNode fast head.next, slow head;while (fast ! null && fast.next ! null) {slow slow.next;fast fast.next.nex…

【问题处理】银河麒麟操作系统实例分享,服务器操作系统VNC远程问题分析

1.服务器环境以及配置 【内核版本】 4.19.90-23.8.v2101.ky10.aarch64 【OS镜像版本】 0518-server 2.问题现象描述 服务器通过vncserver:1.service服务启动的vnc服务后&#xff0c;普通用户用vnc连接时&#xff0c;锁屏后&#xff0c;然后输入登陆密码会报密码错误&…

Ubuntu搭建Python虚拟环境:virtualenv

1 缘起 一阶段&#xff1a;Python开发&#xff0c;使用Windows环境&#xff0c;使用的相关依赖在Windows环境都能使用&#xff1b; 进入二阶段&#xff0c;开发了一个新功能&#xff0c;使用了k8s&#xff0c;Python依赖为&#xff1a;easy_k8s&#xff0c; 刚好&#xff0c;e…