如何使用gprof对程序进行性能分析

如何使用gprof对程序进行性能分析


目录

1 gprof概述
2 gprof原理简述
3 gprof使用
  3.1 gprof使用简述
  3.2 gprof使用示例
4 小结


1 gprof概述

    gprof 是 一个 GNU 的程序性能分析工具,可以用于分析C\C++程序的执行性能。gprof工具可以统计出各个函数的调用次数、执行时间、函数调用关系,具体功能可以通过 man gprof进一步了解。通常该工具在大多数linux内核的发行版本中会在你安装C/C++编译器的同时默认安装上。


2 gprof原理简述

    通过在编译、链接的时候使用 -pg 选项,就能够控制gcc/g++ 编译器在程序的每个函数中插入插桩函数,从而跟踪目标函数的执行时间、调用关系(通过函数调用堆栈查找)、执行次数等信息,并将相关数据保存到 gmon.out 文件中。

    【注意】: 必须是编译链接的时候都要添加 -pg 参数。并且目标程序不能使用 strip 命令去除符号表,否则 gprof 工具无法正常处理 gmon.out 到 profile.txt文件。


3 gprof使用

3.1 gprof使用简述

a、 在编译、链接设置中开启 -pg 参数:

    使用cmake,在CMakeList.txt中添加

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")

    使用make,在Makefile中设置

CFLAGS += -pg
CPPFLAGS += -pg
LDFLAGS += -pg

b、 编译后正常运行程序

.testApp arg1 arg2

【注意】 运行程序后,要程序正常退出,才能正常生成 gmon.out 文件;在此步骤中程序是可以带命令行参数执行的。

c、 分析、收集数据

gprof testApp gmon.out > profile.txt

【注意】 在此步骤中,目标程序如果是带参的,此步骤不可以填入命令行参数。

d、 分析数据图形化

gprof2dot -e0 -n0 profile.txt > profile.dot
dot profile.dot -Tpng -o profile.png

【说明】 在此步骤中,需要通过 gprof2dot 和 dot工具将结果图形化,方便查看。

3.2 gprof使用示例

上一小节简单讲述了如何 gprof 的使用,本小节会以 s_log_safe开源项目 为实例,介绍如何使用 gprof 工具 进行性能分析。

a、 clone s_log_safe项目源码

git clone https://github.com/smallerxuan/s_log_safe.gitcd s_log_safetree

clone完成后进入路径,能看到如下的目录结构:

在这里插入图片描述

b、 修改Makefile文件

gedit ./Makefile

用编辑器打开 Makefile文件,修改 FLAGS_BASE 关闭O2优化,添加 -pg 选项;给 LDFLAGS 追加 -pg;注释 strip 调用。

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

c、 调整测试用例并编译项目

gedit ./main.c

用编辑器打开 main.c 文件,对测试程序进行简单修改,不然测试程序不会自然结束。

#include <stdio.h>
#include "s_log_safe.h"static int test_mark = 8;void* thread_1_exec(void* arg)
{int* count =  (int*)arg;s_safe_tag("thread_1", S_LOG_SAFE_OPT_DEBUG);do {s_log_safe_a("%s %d","测试1",*count);usleep(5000);} while (*count -= 1);test_mark -= 1;return s_log_safe_null;
}void* thread_2_exec(void* arg)
{int* count =  (int*)arg;s_safe_tag("thread_2", S_LOG_SAFE_OPT_DEBUG);do {s_log_safe_v("%s %d","测试2",*count);usleep(5000);} while (*count -= 1);test_mark -= 1;return s_log_safe_null;
}void* thread_3_exec(void* arg)
{int* count =  (int*)arg;s_safe_tag("thread_3", S_LOG_SAFE_OPT_DEBUG);do {s_log_safe_e("%s %d","测试3",*count);usleep(5000);} while (*count -= 1);test_mark -= 1;return s_log_safe_null;
}void* thread_4_exec(void* arg)
{int* count =  (int*)arg;s_safe_tag("thread_4", S_LOG_SAFE_OPT_DEBUG);do {s_log_safe_w("%s %d","测试4",*count);usleep(5000);} while (*count -= 1);test_mark -= 1;return s_log_safe_null;
}void* thread_5_exec(void* arg)
{int* count =  (int*)arg;s_safe_tag("thread_5", S_LOG_SAFE_OPT_DEBUG);do {s_log_safe_t("%s %d","测试5",*count);usleep(5000);} while (*count -= 1);test_mark -= 1;return s_log_safe_null;
}void* thread_6_exec(void* arg)
{int* count =  (int*)arg;s_safe_tag("thread_6", S_LOG_SAFE_OPT_DEBUG);do {s_log_safe_i("%s %d","测试6",*count);usleep(5000);} while (*count -= 1);test_mark -= 1;return s_log_safe_null;
}void* thread_7_exec(void* arg)
{int* count =  (int*)arg;s_safe_tag("thread_7", S_LOG_SAFE_OPT_TRACE);do {s_log_safe_d("%s %d","测试7",*count);if((*count)%8 == 0) {s_safe_tag_log_level_limit_set(S_LOG_SAFE_OPT_DEBUG);} else {s_safe_tag_log_level_limit_set(S_LOG_SAFE_OPT_TRACE);}usleep(5000);} while (*count -= 1);test_mark -= 1;return s_log_safe_null;
}void* thread_main_exec(void* arg)
{int count = 0;unsigned int log_safe_pool_cap = 0;unsigned int log_safe_pool_used = 0;s_safe_tag("main", S_LOG_SAFE_OPT_DEBUG);log_safe_pool_cap = s_log_safe_output_pool_cap_get();while(test_mark > 1) {log_safe_pool_used = s_log_safe_output_pool_used_get();s_log_safe_i("%s log_safe_pool_cap:%d log_safe_pool_used:%d count:%d","main", log_safe_pool_cap, log_safe_pool_used, count++);usleep(5000);}test_mark -= 1;return s_log_safe_null;
}int main(void)
{int                  ret = 0;s_log_safe_thread_t* s_log_safe_thread_1_p;s_log_safe_thread_t* s_log_safe_thread_2_p;s_log_safe_thread_t* s_log_safe_thread_3_p;s_log_safe_thread_t* s_log_safe_thread_4_p;s_log_safe_thread_t* s_log_safe_thread_5_p;s_log_safe_thread_t* s_log_safe_thread_6_p;s_log_safe_thread_t* s_log_safe_thread_7_p;s_log_safe_thread_t* s_log_safe_thread_main_p;int                  count_1 = 77;int                  count_2 = 66;int                  count_3 = 55;int                  count_4 = 44;int                  count_5 = 33;int                  count_6 = 22;int                  count_7 = 11;ret = s_log_safe_init();if(ret != 0) {return 0;}s_log_safe_thread_7_p = s_log_safe_thread_create(thread_main_exec, (void*)s_log_safe_null, "", S_LOG_SAFE_THREAD_PRIORITY, 1024);s_log_safe_thread_1_p = s_log_safe_thread_create(thread_1_exec, (void*)&count_1, "", 10, 1024);s_log_safe_thread_2_p = s_log_safe_thread_create(thread_2_exec, (void*)&count_2, "", 10, 1024);s_log_safe_thread_3_p = s_log_safe_thread_create(thread_3_exec, (void*)&count_3, "", 12, 1024);s_log_safe_thread_4_p = s_log_safe_thread_create(thread_4_exec, (void*)&count_4, "", 12, 1024);s_log_safe_thread_5_p = s_log_safe_thread_create(thread_5_exec, (void*)&count_5, "", 11, 1024);s_log_safe_thread_6_p = s_log_safe_thread_create(thread_6_exec, (void*)&count_6, "", 11, 1024);s_log_safe_thread_7_p = s_log_safe_thread_create(thread_7_exec, (void*)&count_7, "", 10, 1024);while(test_mark != 0) {sleep(1);}return 0;
}

修改完成后运行make命令编译测试程序。

make

运行 make 命令后,会在 ./buld 路径生成目标测试程序。
在这里插入图片描述

d、 运测试程序

cd ./build/./s_log_safe_test

切换到 ./build 路径后执行测试程序,通过 ls 会在路径下发现新生成了一个 gmon.out 文件。
在这里插入图片描述

e、 分析、收集数据

gprof s_log_safe_test gmon.out > profile.txt

通过该命令,可以在路径下看见导出的分析结果文件 profile.txt。在该文件中,详细的记录了 函数的执行时间、调用关系、执行次数等信息。但是还不是特别方便查看,毕竟看图会更直观。
在这里插入图片描述
profile.txt文件的内容如下:

Flat profile:Each sample counts as 0.01 seconds.no time accumulated%   cumulative   self              self     total           time   seconds   seconds    calls  Ts/call  Ts/call  name    0.00      0.00     0.00     2048     0.00     0.00  s_log_safe_mutex_unlock0.00      0.00     0.00     2048     0.00     0.00  s_ring_buffer_unlock0.00      0.00     0.00     1294     0.00     0.00  s_log_safe_mutex_lock0.00      0.00     0.00     1294     0.00     0.00  s_ring_buffer_lock0.00      0.00     0.00      752     0.00     0.00  s_log_safe_mutex_try_lock0.00      0.00     0.00      752     0.00     0.00  s_log_strrchr0.00      0.00     0.00      751     0.00     0.00  s_ring_buffer_try_lock0.00      0.00     0.00      544     0.00     0.00  s_ring_buffer_could_read_num_get0.00      0.00     0.00      383     0.00     0.00  s_log_safe_out0.00      0.00     0.00      376     0.00     0.00  s_log_out_by_printf0.00      0.00     0.00      376     0.00     0.00  s_log_print0.00      0.00     0.00      376     0.00     0.00  s_log_safe_output0.00      0.00     0.00      376     0.00     0.00  s_ring_buffer_read_elements0.00      0.00     0.00      374     0.00     0.00  s_ring_buffer_write_elements0.00      0.00     0.00       78     0.00     0.00  s_log_safe_output_pool_used_get0.00      0.00     0.00        9     0.00     0.00  get_thread_policy0.00      0.00     0.00        9     0.00     0.00  s_log_safe_thread_create0.00      0.00     0.00        2     0.00     0.00  s_log_safe_mutex_create0.00      0.00     0.00        2     0.00     0.00  s_ring_buffer_lock_create0.00      0.00     0.00        1     0.00     0.00  s_log_safe_constructor0.00      0.00     0.00        1     0.00     0.00  s_log_safe_init0.00      0.00     0.00        1     0.00     0.00  s_log_safe_output_pool_cap_get0.00      0.00     0.00        1     0.00     0.00  s_ring_buffer_constructor0.00      0.00     0.00        1     0.00     0.00  s_ring_buffer_element_pool_constructor_malloc%         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-2015 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 2 byte(s) no time propagatedindex % time    self  children    called     name0.00    0.00    2048/2048        s_ring_buffer_unlock [2]
[1]      0.0    0.00    0.00    2048         s_log_safe_mutex_unlock [1]
-----------------------------------------------0.00    0.00       2/2048        s_ring_buffer_constructor [23]0.00    0.00     544/2048        s_ring_buffer_could_read_num_get [8]0.00    0.00     750/2048        s_ring_buffer_write_elements [14]0.00    0.00     752/2048        s_ring_buffer_read_elements [13]
[2]      0.0    0.00    0.00    2048         s_ring_buffer_unlock [2]0.00    0.00    2048/2048        s_log_safe_mutex_unlock [1]
-----------------------------------------------0.00    0.00    1294/1294        s_ring_buffer_lock [4]
[3]      0.0    0.00    0.00    1294         s_log_safe_mutex_lock [3]
-----------------------------------------------0.00    0.00     374/1294        s_ring_buffer_write_elements [14]0.00    0.00     376/1294        s_ring_buffer_read_elements [13]0.00    0.00     544/1294        s_ring_buffer_could_read_num_get [8]
[4]      0.0    0.00    0.00    1294         s_ring_buffer_lock [4]0.00    0.00    1294/1294        s_log_safe_mutex_lock [3]
-----------------------------------------------0.00    0.00     752/752         s_ring_buffer_try_lock [7]
[5]      0.0    0.00    0.00     752         s_log_safe_mutex_try_lock [5]
-----------------------------------------------0.00    0.00     752/752         s_log_safe_output [12]
[6]      0.0    0.00    0.00     752         s_log_strrchr [6]
-----------------------------------------------0.00    0.00     375/751         s_ring_buffer_write_elements [14]0.00    0.00     376/751         s_ring_buffer_read_elements [13]
[7]      0.0    0.00    0.00     751         s_ring_buffer_try_lock [7]0.00    0.00     752/752         s_log_safe_mutex_try_lock [5]
-----------------------------------------------0.00    0.00      78/544         s_log_safe_output_pool_used_get [15]0.00    0.00     466/544         s_log_safe_thread_exec_func [36]
[8]      0.0    0.00    0.00     544         s_ring_buffer_could_read_num_get [8]0.00    0.00     544/1294        s_ring_buffer_lock [4]0.00    0.00     544/2048        s_ring_buffer_unlock [2]
-----------------------------------------------0.00    0.00      11/383         thread_7_exec [50]0.00    0.00      22/383         thread_6_exec [49]0.00    0.00      33/383         thread_5_exec [48]0.00    0.00      43/383         thread_4_exec [47]0.00    0.00      55/383         thread_3_exec [46]0.00    0.00      66/383         thread_2_exec [45]0.00    0.00      76/383         thread_1_exec [44]0.00    0.00      77/383         thread_main_exec [51]
[9]      0.0    0.00    0.00     383         s_log_safe_out [9]0.00    0.00     374/374         s_ring_buffer_write_elements [14]
-----------------------------------------------0.00    0.00     376/376         s_log_print [11]
[10]     0.0    0.00    0.00     376         s_log_out_by_printf [10]
-----------------------------------------------0.00    0.00     376/376         s_log_safe_output [12]
[11]     0.0    0.00    0.00     376         s_log_print [11]0.00    0.00     376/376         s_log_out_by_printf [10]
-----------------------------------------------0.00    0.00     376/376         s_log_safe_thread_exec_func [36]
[12]     0.0    0.00    0.00     376         s_log_safe_output [12]0.00    0.00     752/752         s_log_strrchr [6]0.00    0.00     376/376         s_ring_buffer_read_elements [13]0.00    0.00     376/376         s_log_print [11]
-----------------------------------------------0.00    0.00     376/376         s_log_safe_output [12]
[13]     0.0    0.00    0.00     376         s_ring_buffer_read_elements [13]0.00    0.00     752/2048        s_ring_buffer_unlock [2]0.00    0.00     376/751         s_ring_buffer_try_lock [7]0.00    0.00     376/1294        s_ring_buffer_lock [4]
-----------------------------------------------0.00    0.00     374/374         s_log_safe_out [9]
[14]     0.0    0.00    0.00     374         s_ring_buffer_write_elements [14]0.00    0.00     750/2048        s_ring_buffer_unlock [2]0.00    0.00     375/751         s_ring_buffer_try_lock [7]0.00    0.00     374/1294        s_ring_buffer_lock [4]
-----------------------------------------------0.00    0.00      78/78          thread_main_exec [51]
[15]     0.0    0.00    0.00      78         s_log_safe_output_pool_used_get [15]0.00    0.00      78/544         s_ring_buffer_could_read_num_get [8]
-----------------------------------------------0.00    0.00       9/9           s_log_safe_thread_create [17]
[16]     0.0    0.00    0.00       9         get_thread_policy [16]
-----------------------------------------------0.00    0.00       1/9           s_log_safe_init [21]0.00    0.00       8/9           main [30]
[17]     0.0    0.00    0.00       9         s_log_safe_thread_create [17]0.00    0.00       9/9           get_thread_policy [16]
-----------------------------------------------0.00    0.00       2/2           s_ring_buffer_lock_create [19]
[18]     0.0    0.00    0.00       2         s_log_safe_mutex_create [18]
-----------------------------------------------0.00    0.00       2/2           s_ring_buffer_constructor [23]
[19]     0.0    0.00    0.00       2         s_ring_buffer_lock_create [19]0.00    0.00       2/2           s_log_safe_mutex_create [18]
-----------------------------------------------0.00    0.00       1/1           s_log_safe_init [21]
[20]     0.0    0.00    0.00       1         s_log_safe_constructor [20]0.00    0.00       1/1           s_ring_buffer_constructor [23]
-----------------------------------------------0.00    0.00       1/1           main [30]
[21]     0.0    0.00    0.00       1         s_log_safe_init [21]0.00    0.00       1/1           s_log_safe_constructor [20]0.00    0.00       1/9           s_log_safe_thread_create [17]
-----------------------------------------------0.00    0.00       1/1           thread_main_exec [51]
[22]     0.0    0.00    0.00       1         s_log_safe_output_pool_cap_get [22]
-----------------------------------------------0.00    0.00       1/1           s_log_safe_constructor [20]
[23]     0.0    0.00    0.00       1         s_ring_buffer_constructor [23]0.00    0.00       2/2           s_ring_buffer_lock_create [19]0.00    0.00       2/2048        s_ring_buffer_unlock [2]0.00    0.00       1/1           s_ring_buffer_element_pool_constructor_malloc [24]
-----------------------------------------------0.00    0.00       1/1           s_ring_buffer_constructor [23]
[24]     0.0    0.00    0.00       1         s_ring_buffer_element_pool_constructor_malloc [24]
-----------------------------------------------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-2015 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[16] get_thread_policy (s_log_safe_platform.c) [1] s_log_safe_mutex_unlock [8] s_ring_buffer_could_read_num_get[10] s_log_out_by_printf     [9] s_log_safe_out         [24] s_ring_buffer_element_pool_constructor_malloc[11] s_log_print            [12] s_log_safe_output (s_log_safe.c) [4] s_ring_buffer_lock[20] s_log_safe_constructor (s_log_safe.c) [22] s_log_safe_output_pool_cap_get [19] s_ring_buffer_lock_create[21] s_log_safe_init        [15] s_log_safe_output_pool_used_get [13] s_ring_buffer_read_elements[18] s_log_safe_mutex_create [17] s_log_safe_thread_create [7] s_ring_buffer_try_lock[3] s_log_safe_mutex_lock   [6] s_log_strrchr           [2] s_ring_buffer_unlock[5] s_log_safe_mutex_try_lock [23] s_ring_buffer_constructor [14] s_ring_buffer_write_elements

f、 生成调用图

gprof2dot -e0 -n0 profile.txt > profile.dot
dot profile.dot -Tpng -o profile.png

通过 gprof2dot 和 dot 工具能够将 profile.txt 文件转换为 更直观的 图片。
在这里插入图片描述
在这里插入图片描述

如果没有安装 gprof2dot 和 dot 工具,可以通过以下命令进行安装:

sudo apt-get install graphvizpip3 install gprof2dot

g、 查看调用图

通过上述操作,最终生成了 profile.png 文件,最终的调用图如下图所示:
在这里插入图片描述
从该图中,就比较直观的看到了调用流程和调用次数


4 小结

上述的通过 gprof 和相关工具 对目标程序 进行 性能分析,是日常开发过程中常用的一种方式。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/31551.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

什么是 vCPU?有什么作用

vCPU 是物理 CPU 的虚拟化版本&#xff0c;是云计算的基本组成部分。这些虚拟化计算单元的一大优势是其良好的可扩展性&#xff0c;这也是它们在云托管中发挥重要作用的原因。 vCPU 有什么作用? vCPU(虚拟中央处理器)是物理CPU的虚拟化变体。换句话说&#xff0c;vCPU 是虚拟机…

邀请函 | 桥田智能出席AMTS展会 家族新成员正式发布

作为国际汽车制造技术与装备及材料专业展览会&#xff0c;AMTS将于2024年7月3-5日在上海新国际博览中心举行。本届展会以【向“新”而行 “智”领未来】为主题&#xff0c;聚焦汽车及新能源全产业链&#xff0c;围绕“车身工程、部件工程、新能源三电工程及未来汽车开发”等技…

重塑W来|暴雨携手英特尔®单路最强“芯”加速数智创新应用

近日&#xff0c;极“至”能&#xff0c;重塑“W”来—英特尔单路最强“芯”XeonW 方案研讨会在贵阳成果举办&#xff0c;行业精英们共聚一堂&#xff0c;了解Xeon W处理器的最新进展、卓越性能和多元应用场景&#xff0c;并针对最新的行业趋势、技术创新以及战略规划进行深入…

90 岁老人靠一辆自行车年赚 170 亿,捷安特如何打造山地车极致产品力?

一位富家小开在中年时经商失败&#xff0c;38岁时从零开始创业&#xff0c;最终在自行车整车市场占据了70%的份额&#xff0c;他是怎么做到的&#xff1f; 一家曾为美国自行车品牌代工的台湾工厂&#xff0c;成功从ToB转型为ToC业务&#xff0c;从90%的代工业务转变为全球最大…

QT 中charts各种图表的综合应用

此文章是根据Qt之QChart各个图表的简单使用&#xff08;含源码注释&#xff09;-CSDN博客进行的简单优化。 这里面用了几种数值轴QT 数值型坐标轴有那些&#xff1f;&#xff08;QValueAxis&#xff09;-CSDN博客&#xff0c;对图例进行了一定的设置&#xff0c;还有多个相同控…

LeetCode | 415.字符串相加

这道题可以直接使用api&#xff0c;一行代码解决&#xff0c;但是这样就失去了这道题原本的意思了&#xff0c;自己实现的话考虑竖式加法的形式&#xff0c;从两个数字的末尾开始相加&#xff0c;满十进1&#xff0c;当其中一个字符串遍历完了直接补0即可&#xff0c;直至遍历完…

SpringBoot的迭代史,SpringBoot和Spring和Java和Maven和Gradle版本兼容介绍

文章目录 系统环境要求&#xff1a;Spring Boot 3.1.xSpring Boot 3.0.xSpring Boot 2.7.xSpring Boot 2.6.xSpring Boot 2.5.xSpring Boot 2.4.xSpring Boot 2.3.xSpring Boot 2.2.xSpring Boot 2.1.xSpring Boot 2.0.xSpring Boot 1.5.xSpring Boot 1.4.xSpring Boot 1.3.xSp…

2024广东省职业技能大赛云计算赛项实战——Ansible部署Zabbix

Ansible部署Zabbix 前言 今年的比赛考了一道Ansible部署Zabbix的题目&#xff0c;要求就是用两台centos7.5的云主机&#xff0c;一台叫ansible&#xff0c;一台叫node&#xff0c;使用对应的软件包&#xff0c;通过ansible节点控制node节点安装zabbix服务。这道题还是算比较简…

【数据分享】《中国改革年鉴》1989-2022

最近老有同学过来询问《中国经济体制改革年鉴》、《中国改革年鉴》这两本数据的关系以及怎么获取这两本本数据。今天就在这里给大家分享一下这三本数据的具体情况。 《中国改革年鉴》由国家发展和改革委员会主管,中国经济体制改革研究会主办,中国经济体制改革杂志社编辑出版,是…

俄罗斯塔斯社TASS 媒体投放报道:海外媒体发稿扭转战局

大舍传媒 -作为一家颇具影响力的媒体机构&#xff0c;一直致力于传播客观、真实的新闻信息。最近&#xff0c;大舍传媒注意到了塔斯社TASS的报道&#xff0c;了解到海外媒体发稿对于扭转国内局势有着重要的影响。本文将就此话题进行分析探讨。 塔斯社TASS&#xff1a;俄语区最…

职工管理系统

需求分析 系统需要能够实现对职工信息的插入、删除、查找、修改和排序功能。职工信息包括职工编号、姓名、性别、出生年月、参加工作年月、学历、职务、住址、电话等信息。界面友好&#xff0c;通过菜单实现以上功能&#xff0c;操作简单&#xff0c;能够方便快捷地进行信息管理…

云渲染可以渲染SketchUp吗?

最近有很多人在问&#xff0c;云渲染可以渲染sketchup吗&#xff1f;答案是可以的&#xff0c;不过只有两三家支持&#xff0c;大部分云渲染是还是不支持的&#xff0c;今天就给大家介绍国内最新支持sketchup渲染的云渲染——炫云云渲染的使用方法。 炫云云渲染目前支持sketchu…

【QCustomPlot实战系列】QCPGraph堆叠面积图

在【QCustomPlot实战系列】QCPGraph堆叠图的基础上&#xff0c;使用setChannelFillGraph函数即可 static QCPScatterStyle GetScatterStyle(const QColor& color) {QPen pen(color, 2);return QCPScatterStyle(QCPScatterStyle::ssCircle,pen,Qt::white, 5); }static QCP…

Linux企业架构(存储服务)

1.1概述 存储&#xff1a;用户存放上传的内容&#xff08;数据&#xff09;&#xff0c;一般应用在网站集群中为何用&#xff1f; 1. 如果不使用存储&#xff0c;用户上传的数据就直接存放在网站服务器上&#xff0c;用户下次访问可能找不到 2. 如果使用存储&#xff0c;用户上…

低成本创业新篇章:上门回收小程序的崛起与挑战

在当今这个快速变化的时代&#xff0c;低成本创业项目成为了许多创业者的首选。其中&#xff0c;上门回收小程序以其独特的商业模式和市场需求&#xff0c;成为了创业市场中的一股新势力。本文将深入探讨上门回收小程序作为低成本创业项目的崛起之路以及面临的挑战。 一、上门回…

【Sa-Token|3】Sa-Token集成到现有微服务详细介绍

一、系统架构调整 用户中心&#xff1a;保持现有的用户登录、注册接口不变。多个项目&#xff1a;前后端分离&#xff0c;保持现有逻辑不变。网关服务&#xff1a;新增或配置网关服务&#xff0c;处理所有请求并进行 Token 校验和转发。统一 Token 管理&#xff1a;通过 Sa-Tok…

嵌入式系统软件开发环境_2.一般架构

1.Eclipse框架 嵌入式系统软件开发环境是可帮助用户开发嵌入式软件的一组工具的集合&#xff0c;其架构的主要特征离不开“集成”问题&#xff0c;采用什么样的架构框架是决定开发环境优劣主要因素。Eclipse框架是当前嵌入式系统软件开发环境被普遍公认的一种基础环境框架。目…

html做一个画热图的软件

完整示例 <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><title>热图生成器</title><script src"https://cdn.plot.ly/plotly-latest.min.js"></script><style>body …

A.P.穆勒-马士基将作为银牌赞助商出席2024中国汽车供应链降碳和可持续国际峰会

作为一家综合性集装箱物流公司&#xff0c;A.P.穆勒-马士基致力于连接和简化我们客户的供应链。作为物流服务领域的全球领导者&#xff0c;公司拥有100,000多家客户&#xff0c;业务遍及130多个国家&#xff0c;拥有约80,000名员工。A.P.穆勒-马士基致力于通过新技术、新船舶和…

Syslog日志外发

Syslog是一种广泛应用于网络设备、操作系统和应用程序的日志通信协议&#xff0c;通过收集、监控和分析Syslog日志&#xff0c;企业可以有效维护网络安全、故障排除和运营管理。 除了内部监控&#xff0c;有时企业也需要将Syslog日志外发以实现更多的管理和合规需求。在实现Sy…