go tool pprof与trace的简单使用

news2024/11/14 22:35:20

pprof

pprof是Google的程序采样分析工具,其使用分为,采样和分析。Go 语言内置了pprof。
Go 语言库中有两种方式使用pprof,一种是通过net/http/pprof库,另一种是通过runtime/pprof库。

net/http/pprof的简单使用

引入 _ "net/http/pprof"库,开启http://localhost:6060端口的服务,注意其ListenAndServeaddr是可以指定的,handler参数为nil。

package main

import (
	"math/rand"
	"net/http"
	_ "net/http/pprof"
	"runtime"
	"sync"
	"time"
)

func main() {
	runtime.SetMutexProfileFraction(1) // 开启对锁调用的跟踪
	runtime.SetBlockProfileRate(1)     // 开启对阻塞的跟踪

	go func() {
		if err := http.ListenAndServe(":6060", nil); err != nil {
			panic(err)
		}
	}()

	wg := new(sync.WaitGroup)
	randFunction(wg)
	wg.Wait()
}

func randFunction(wg *sync.WaitGroup) {
	rand.Seed(time.Now().UnixNano())
	for i := 0; i < 100; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			s := make([]int, rand.Intn(100000))
			time.Sleep(time.Second * time.Duration(rand.Intn(999999)))
			_ = s
		}()
	}
}

启动程序后,打开浏览器输入:http://localhost:6060/debug/pprof/。可见如下页面:
在这里插入图片描述
配置文件说明:
allocs(分配): 所有过去内存分配的样本
block(阻塞):导致同步基元阻塞的堆栈跟踪
cmdline(命令行程序):当前程序的命令行调用
goroutine(协程信息):当前所有 goroutines 的堆栈跟踪
heap(堆信息):活动对象的内存分配采样。您可以指定 gc GET 参数以在获取堆示例之前运行 GC
mutex(锁信息):争用互斥锁持有者的堆栈跟踪
profile(配置信息):CPU 配置文件。您可以在秒 GET 参数中指定持续时间。获取配置文件后,使用 go 工具 pprof 命令调查配置文件。
threadcreate(线程创建):导致创建新的操作系统线的程堆栈跟踪
trace(跟踪):当前程序执行的跟踪。您可以在秒 GET 参数中指定持续时间。获取跟踪文件后,使用 go 工具跟踪命令调查跟踪
full goroutine stack dump:dump 所有协程的栈信息
蓝色文字前的数字描述了该操作的“具体数量”
蓝色超链接是可以点击的,比如点击:goroutine
跳转到了http://localhost:6060/debug/pprof/goroutine?debug=1链接,这里展示了goroutine的跟踪信息。
在这里插入图片描述
http://localhost:6060/debug/pprof/goroutine?debug=1中结尾的?debug=1去掉,即可下载当前goroutine的跟踪信息到文件,可用具体的分析工具对其进行分析。

go tool pprof 分析工具

-h 选项可以查看帮助信息。
该工具可以静态分析数据文件,也可以动态的网络流分析。
可以看出pprof <format> [options] [binary] <source> ... pprof 其后可跟一个source,这个source可以是从浏览器下载(curl 也可以获取,或使用runtime/pprof生成)的数据问文件,也可以是一个链接

...\example>go tool pprof -h                                       
usage:
                                                                         
Produce output in the specified format.                                  
                                                                         
   pprof <format> [options] [binary] <source> ...

Omit the format to get an interactive shell whose commands can be used   
to generate various views of a profile

   pprof [options] [binary] <source> ...
                                                                         
Omit the format and provide the "-http" flag to get an interactive web   
interface at the specified host:port that can be used to navigate through
various views of a profile.                                              

   pprof -http [host]:[port] [options] [binary] <source> ...

Details:
  Output formats (select at most one):
    -callgrind       Outputs a graph in callgrind format
    -comments        Output all profile comments
    -disasm          Output assembly listings annotated with samples
    -dot             Outputs a graph in DOT format
    -eog             Visualize graph through eog
    -evince          Visualize graph through evince
    -gif             Outputs a graph image in GIF format
    -gv              Visualize graph through gv
    -kcachegrind     Visualize report in KCachegrind
    -list            Output annotated source for functions matching regexp
    -pdf             Outputs a graph in PDF format
    -peek            Output callers/callees of functions matching regexp
    -png             Outputs a graph image in PNG format
    -proto           Outputs the profile in compressed protobuf format
    -ps              Outputs a graph in PS format
    -raw             Outputs a text representation of the raw profile
    -svg             Outputs a graph in SVG format
    -tags            Outputs all tags in the profile
    -text            Outputs top entries in text form
    -top             Outputs top entries in text form
    -topproto        Outputs top entries in compressed protobuf format
    -traces          Outputs all profile samples in text form
    -tree            Outputs a text rendering of call graph
    -web             Visualize graph through web browser
    -weblist         Display annotated source in a web browser

  Options:
    -call_tree       Create a context-sensitive call tree
    -compact_labels  Show minimal headers
    -divide_by       Ratio to divide all samples before visualization
    -drop_negative   Ignore negative differences
    -edgefraction    Hide edges below <f>*total
    -focus           Restricts to samples going through a node matching regexp
    -hide            Skips nodes matching regexp
    -ignore          Skips paths going through any nodes matching regexp
    -intel_syntax    Show assembly in Intel syntax
    -mean            Average sample value over first value (count)
    -nodecount       Max number of nodes to show
    -nodefraction    Hide nodes below <f>*total
    -noinlines       Ignore inlines.
    -normalize       Scales profile based on the base profile.
    -output          Output filename for file-based outputs
    -prune_from      Drops any functions below the matched frame.
    -relative_percentages Show percentages relative to focused subgraph
    -sample_index    Sample value to report (0-based index or name)
    -show            Only show nodes matching regexp
    -show_from       Drops functions above the highest matched frame.
    -source_path     Search path for source files
    -tagfocus        Restricts to samples with tags in range or matched by regexp
    -taghide         Skip tags matching this regexp
    -tagignore       Discard samples with tags in range or matched by regexp
    -tagleaf         Adds pseudo stack frames for labels key/value pairs at the callstack leaf.
    -tagroot         Adds pseudo stack frames for labels key/value pairs at the callstack root.
    -tagshow         Only consider tags matching this regexp
    -trim            Honor nodefraction/edgefraction/nodecount defaults
    -trim_path       Path to trim from source paths before search
    -unit            Measurement units to display

  Option groups (only set one per group):
    granularity
      -functions       Aggregate at the function level.
      -filefunctions   Aggregate at the function level.
      -files           Aggregate at the file level.
      -lines           Aggregate at the source code line level.
      -addresses       Aggregate at the address level.
    sort
      -cum             Sort entries based on cumulative weight
      -flat            Sort entries based on own weight

  Source options:
    -seconds              Duration for time-based profile collection
    -timeout              Timeout in seconds for profile collection
    -buildid              Override build id for main binary
    -add_comment          Free-form annotation to add to the profile
                          Displayed on some reports or with pprof -comments
    -diff_base source     Source of base profile for comparison
    -base source          Source of base profile for profile subtraction
    profile.pb.gz         Profile in compressed protobuf format
    legacy_profile        Profile in legacy pprof format
    http://host/profile   URL for profile handler to retrieve
    -symbolize=           Controls source of symbol information
      none                  Do not attempt symbolization
      local                 Examine only local binaries
      fastlocal             Only get function names from local binaries
      remote                Do not examine local binaries
      force                 Force re-symbolization
    Binary                  Local path or build id of binary for symbolization
    -tls_cert             TLS client certificate file for fetching profile and symbols
    -tls_key              TLS private key file for fetching profile and symbols
    -tls_ca               TLS CA certs file for fetching profile and symbols

  Misc options:
   -http              Provide web interface at host:port.
                      Host is optional and 'localhost' by default.
                      Port is optional and a randomly available port by default.
   -no_browser        Skip opening a browser for the interactive web UI.
   -tools             Search path for object tools

  Legacy convenience options:
   -inuse_space           Same as -sample_index=inuse_space
   -inuse_objects         Same as -sample_index=inuse_objects
   -alloc_space           Same as -sample_index=alloc_space
   -alloc_objects         Same as -sample_index=alloc_objects
   -total_delay           Same as -sample_index=delay
   -contentions           Same as -sample_index=contentions
   -mean_delay            Same as -mean -sample_index=delay

  Environment Variables:
   PPROF_TMPDIR       Location for saved profiles (default $HOME/pprof)
   PPROF_TOOLS        Search path for object-level tools
   PPROF_BINARY_PATH  Search path for local binary files
                      default: $HOME/pprof/binaries
                      searches $name, $path, $buildid/$name, $path/$buildid
   * On Windows, %USERPROFILE% is used instead of $HOME

使用go tool pprof http://localhost:6060/debug/pprof/allocs分析当前应用内存信息。

...\Desktop\example>go tool pprof http://localhost:6060/debug/pprof/allocs   
Fetching profile over HTTP from http://localhost:6060/debug/pprof/allocs
Saved profile in 
...\pprof\pprof.alloc_objects.alloc_space.inuse_objects.inuse_space.002.pb.gz
Type: alloc_space
Time: Jan 22, 2023 at 4:28pm (CST)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof)

可以发现,该命令行是交互式的。
输入help 可以查看其支持的所有子命令。

(pprof) help
  Commands:
    callgrind        Outputs a graph in callgrind format
    comments         Output all profile comments
    disasm           Output assembly listings annotated with samples
    dot              Outputs a graph in DOT format
    eog              Visualize graph through eog
    evince           Visualize graph through evince
    gif              Outputs a graph image in GIF format
    gv               Visualize graph through gv
    kcachegrind      Visualize report in KCachegrind
    list             Output annotated source for functions matching regexp
    pdf              Outputs a graph in PDF format
    peek             Output callers/callees of functions matching regexp
    png              Outputs a graph image in PNG format
    proto            Outputs the profile in compressed protobuf format
    ps               Outputs a graph in PS format
    raw              Outputs a text representation of the raw profile
    svg              Outputs a graph in SVG format
    tags             Outputs all tags in the profile
    text             Outputs top entries in text form
    top              Outputs top entries in text form
    topproto         Outputs top entries in compressed protobuf format
    traces           Outputs all profile samples in text form
    tree             Outputs a text rendering of call graph
    web              Visualize graph through web browser
    weblist          Display annotated source in a web browser
    o/options        List options and their current values
    q/quit/exit/^D   Exit pprof

  Options:
    call_tree        Create a context-sensitive call tree
    compact_labels   Show minimal headers
    divide_by        Ratio to divide all samples before visualization
    drop_negative    Ignore negative differences
    edgefraction     Hide edges below <f>*total
    focus            Restricts to samples going through a node matching regexp
    hide             Skips nodes matching regexp
    ignore           Skips paths going through any nodes matching regexp
    intel_syntax     Show assembly in Intel syntax
    mean             Average sample value over first value (count)
    nodecount        Max number of nodes to show
    nodefraction     Hide nodes below <f>*total
    noinlines        Ignore inlines.
    normalize        Scales profile based on the base profile.
    output           Output filename for file-based outputs
    prune_from       Drops any functions below the matched frame.
    relative_percentages Show percentages relative to focused subgraph
    sample_index     Sample value to report (0-based index or name)
    show             Only show nodes matching regexp
    show_from        Drops functions above the highest matched frame.
    source_path      Search path for source files
    tagfocus         Restricts to samples with tags in range or matched by regexp
    taghide          Skip tags matching this regexp
    tagignore        Discard samples with tags in range or matched by regexp
    tagleaf          Adds pseudo stack frames for labels key/value pairs at the callstack leaf.
    tagroot          Adds pseudo stack frames for labels key/value pairs at the callstack root.
    tagshow          Only consider tags matching this regexp
    trim             Honor nodefraction/edgefraction/nodecount defaults
    trim_path        Path to trim from source paths before search
    unit             Measurement units to display

  Option groups (only set one per group):
    granularity
      functions        Aggregate at the function level.
      filefunctions    Aggregate at the function level.
      files            Aggregate at the file level.
      lines            Aggregate at the source code line level.
      addresses        Aggregate at the address level.
    sort
      cum              Sort entries based on cumulative weight
      flat             Sort entries based on own weight
  :   Clear focus/ignore/hide/tagfocus/tagignore

  type "help <cmd|option>" for more information
(pprof)

使用top,就可以查看所有内存占用信息

(pprof) top
Showing nodes accounting for 46504.27kB, 100% of 46504.27kB total
Showing top 10 nodes out of 34
      flat  flat%   sum%        cum   cum%
42900.35kB 92.25% 92.25% 42900.35kB 92.25%  main.randFunction.func1
  902.59kB  1.94% 94.19%  1553.21kB  3.34%  compress/flate.NewWriter
  650.62kB  1.40% 95.59%   650.62kB  1.40%  compress/flate.(*compressor).init
     514kB  1.11% 96.70%      514kB  1.11%  bufio.NewWriterSize (inline)
  512.50kB  1.10% 97.80%   512.50kB  1.10%  runtime.allocm
  512.20kB  1.10% 98.90%   512.20kB  1.10%  runtime.malg
  512.01kB  1.10%   100%   512.01kB  1.10%  runtime/pprof.printCountProfile.func1
         0     0%   100%  1553.21kB  3.34%  compress/gzip.(*Writer).Write
         0     0%   100%  2065.22kB  4.44%  net/http.(*ServeMux).ServeHTTP
         0     0%   100%  2579.22kB  5.55%  net/http.(*conn).serve
(pprof)

输入top n(1个有效的数字),可以查看前n项内存分配信息

(pprof) top 3
Showing nodes accounting for 44453.56kB, 95.59% of 46504.27kB total
Showing top 3 nodes out of 34
      flat  flat%   sum%        cum   cum%
42900.35kB 92.25% 92.25% 42900.35kB 92.25%  main.randFunction.func1
  902.59kB  1.94% 94.19%  1553.21kB  3.34%  compress/flate.NewWriter
  650.62kB  1.40% 95.59%   650.62kB  1.40%  compress/flate.(*compressor).init
(pprof)

可见,上边的信息最后一列是具体的包名.函数名
使用 list 包名.函数名 可以查看该函数具体内存分配信息

(pprof) list main.randFunction.func1
Total: 45.41MB
ROUTINE ======================== main.randFunction.func1 in 
...\example\main\main.go
   41.89MB    41.89MB (flat, cum) 92.25% of Total
         .          .     28:   rand.Seed(time.Now().UnixNano())
         .          .     29:   for i := 0; i < 100; i++ {
         .          .     30:           wg.Add(1)
         .          .     31:           go func() {
         .          .     32:                   defer wg.Done()
   41.89MB    41.89MB     33:                   s := make([]int, rand.Intn(100000))
         .          .     34:                   time.Sleep(time.Second * time.Duration(rand.Intn(999999)))
         .          .     35:                   _ = s
         .          .     36:           }()
         .          .     37:   }
         .          .     38:}
(pprof)

可以看出导致大量内存分配的罪魁祸首是s := make([]int, rand.Intn(100000)),分配了41.89MB内存

   41.89MB    41.89MB     33:                   s := make([]int, rand.Intn(100000))

输入 web 可以在web端以图的方式展现信息

(pprof) web
failed to execute dot. Is Graphviz installed? Error: exec: "dot": executable file not found in %PATH%
(pprof) 

上边说的是让我们安装Graphviz这个工具。需把该命令加入环境变量的PATH中。
http://www.graphviz.org/该网站中Download即可。
安装时根据个人喜好,选择环境变量。
在这里插入图片描述
此时重启一次命令行,并重新输入

...\example>go tool pprof http://localhost:6060/debug/pprof/allocs
Fetching profile over HTTP from http://localhost:6060/debug/pprof/allocs
Saved profile in 
...\pprof\pprof.alloc_objects.alloc_space.inuse_objects.inuse_space.005.pb.gz
Type: alloc_space
Time: Jan 22, 2023 at 4:46pm (CST)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) web
(pprof)

便可查看具体函数内存占用。同理还可以查看其他指标的信息。
在这里插入图片描述
节点颜色:
红色:累计值cum为正,并且很大
绿色:累计值cum为负,并且很大
灰色:cum可以忽略不计
节点字体大小:
较大的字体表示当前值较大
较小的字体表示当前值较小
边框颜色:
红色:当前值较大并且为正
绿色:当前值较小并未为负
灰色:当前值接近0
箭头大小:
箭头越粗:当前路径消耗的资源越多
箭头越细:当前路径消耗的资源越少
箭头线性:
虚线:两个节点间某些节点可以被忽略,为间接调用
实现:两个节点间为直接调用

在url中可以使用second指定采样的时间:http://localhost:6060/debug/pprof/trace?seconds=5,采样时间为5秒。

使用tree命令可以查找到函数的调用链

(pprof) tree
Showing nodes accounting for 44816.50kB, 100% of 44816.50kB total
----------------------------------------------------------+-------------
      flat  flat%   sum%        cum   cum%   calls calls% + context

----------------------------------------------------------+-------------
43791.80kB 97.71% 97.71% 43791.80kB 97.71%                | main.randFunction.func1
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.newm
  512.50kB  1.14% 98.86%   512.50kB  1.14%                | runtime.allocm
----------------------------------------------------------+-------------
                                          512.20kB   100% |   runtime.newproc1
  512.20kB  1.14%   100%   512.20kB  1.14%                | runtime.malg
----------------------------------------------------------+-------------
         0     0%   100%   512.50kB  1.14%                | runtime.mstart
                                          512.50kB   100% |   runtime.mstart0
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.mstart
         0     0%   100%   512.50kB  1.14%                | runtime.mstart0
                                          512.50kB   100% |   runtime.mstart1
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.mstart0
         0     0%   100%   512.50kB  1.14%                | runtime.mstart1
                                          512.50kB   100% |   runtime.schedule
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.startm
         0     0%   100%   512.50kB  1.14%                | runtime.newm
                                          512.50kB   100% |   runtime.allocm
----------------------------------------------------------+-------------
                                          512.20kB   100% |   runtime.systemstack
         0     0%   100%   512.20kB  1.14%                | runtime.newproc.func1
                                          512.20kB   100% |   runtime.newproc1
----------------------------------------------------------+-------------
                                          512.20kB   100% |   runtime.newproc.func1
         0     0%   100%   512.20kB  1.14%                | runtime.newproc1
                                          512.20kB   100% |   runtime.malg
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.schedule
         0     0%   100%   512.50kB  1.14%                | runtime.resetspinning
                                          512.50kB   100% |   runtime.wakep
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.mstart1
         0     0%   100%   512.50kB  1.14%                | runtime.schedule
                                          512.50kB   100% |   runtime.resetspinning
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.wakep
         0     0%   100%   512.50kB  1.14%                | runtime.startm
                                          512.50kB   100% |   runtime.newm
----------------------------------------------------------+-------------
         0     0%   100%   512.20kB  1.14%                | runtime.systemstack
                                          512.20kB   100% |   runtime.newproc.func1
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.resetspinning
         0     0%   100%   512.50kB  1.14%                | runtime.wakep
                                          512.50kB   100% |   runtime.startm
----------------------------------------------------------+-------------
(pprof)

tree runtime.newm

(pprof) tree runtime.newm
Active filters:
   focus=runtime.newm
Showing nodes accounting for 512.50kB, 1.14% of 44816.50kB total
----------------------------------------------------------+-------------
      flat  flat%   sum%        cum   cum%   calls calls% + context
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.newm
  512.50kB  1.14%  1.14%   512.50kB  1.14%                | runtime.allocm
----------------------------------------------------------+-------------
         0     0%  1.14%   512.50kB  1.14%                | runtime.mstart
                                          512.50kB   100% |   runtime.mstart0
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.mstart
         0     0%  1.14%   512.50kB  1.14%                | runtime.mstart0
                                          512.50kB   100% |   runtime.mstart1
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.mstart0
         0     0%  1.14%   512.50kB  1.14%                | runtime.mstart1
                                          512.50kB   100% |   runtime.schedule
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.startm
         0     0%  1.14%   512.50kB  1.14%                | runtime.newm
                                          512.50kB   100% |   runtime.allocm
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.schedule
         0     0%  1.14%   512.50kB  1.14%                | runtime.resetspinning
                                          512.50kB   100% |   runtime.wakep
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.mstart1
         0     0%  1.14%   512.50kB  1.14%                | runtime.schedule
                                          512.50kB   100% |   runtime.resetspinning
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.wakep
         0     0%  1.14%   512.50kB  1.14%                | runtime.startm
                                          512.50kB   100% |   runtime.newm
----------------------------------------------------------+-------------
                                          512.50kB   100% |   runtime.resetspinning
         0     0%  1.14%   512.50kB  1.14%                | runtime.wakep
                                          512.50kB   100% |   runtime.startm
----------------------------------------------------------+-------------
(pprof)

火焰图

go tool 也内置了火焰图分析工具。
使用
go tool pprof -http :6061 http://localhost:6060/debug/pprof/profile?second=30
在收集30秒信息后会自动打开浏览器,显示火焰图。
在这里插入图片描述
在VIEW中选择Flame Graph。查看火焰图。
在这里插入图片描述
火焰图说明:
root代表程序的开始,单击每个函数可以查看具体信息。
其他框分别代表一个函数,每一层的函数都为平级的,下一层函数被上一层函数所调用。
函数调用栈越长,火焰越明亮。
框越长,颜色越深,代表该函数CPU时间占用越久。

trace 事件跟踪的简单使用

trace可以获取更加详细的调用链信息。
获取30秒trace信息:http://localhost:6060/debug/pprof/trace?second=30
通过浏览器下载该文件。
切换到文件所在路径,执行go tool trace trace最后的trace为刚刚下载的文件名。
程序自动打开了浏览器:
在这里插入图片描述
点击View trace,查看trace信息:
在这里插入图片描述

Reference
《Go 语言底层原理剖析》

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

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

相关文章

【计算机网络】HTTP/HTTPS

HTTP网络协议 虽然我们说, 应用层协议是我们程序猿自己定的. 但实际上, 已经有大佬们定义了一些现成的, 又非常好用的应用层协议, 供我们直接参考使用. HTTP(超文本传输协议)就是其中之一 理解网络协议 协议是一种 “约定”. socket api的接口, 在读写数据时, 都是按 “字符…

零基础学MySQL(三)-- 对表中数据的增删改【新年快乐】

目录✨一、INSERT 语句&#xff08;添加表中数据&#xff09;1.基本语法2.应用案例3.使用细节&#x1f386;二、UPDATE 语句&#xff08;修改表中数据&#xff09;1.基本语法2.应用案例3.使用细节&#x1f387;三、DELETE 语句&#xff08;删除表中数据&#xff09;1.基本语法2…

【手写 Vue2.x 源码】第三十七篇 - 组件部分 - 组件的合并

一&#xff0c;前言 上篇&#xff0c;介绍了 Vue.extend 实现&#xff0c;主要涉及以下几个点&#xff1a; Vue.extend 简介&#xff1b;Vue.extend 实现&#xff0c;包括&#xff1a;组件初始化&#xff1b;子类继承父类&#xff1b;修复 constructor 指向问题&#xff1b; …

基于ssm jsp在线教育系统源码

演示视频&#xff1a; 基于ssm jsp在线教育系统源码范围 系统主要目标设计 随着互联网发展&#xff0c;在线教学成为一种支持知识共享&#xff0c;无距离知识交流的一种方式&#xff0c;我们的系统主要完成在线视频观看&#xff0c;在线教学&#xff0c;在线知识交流&#xff0…

虚幻引擎中CityEngine导入资产的自动化替换

在这篇博文中&#xff0c;我们将学习将 ArcGIS CityEngine Datasmith 场景导入虚幻引擎后替换资产的流程。 替换工作流由虚幻引擎的数据资产&#xff08;可以认为是简单的表格数据&#xff09;控制。 一旦设置正确&#xff0c;这些数据资产就可以在项目之间共享。 推荐&#x…

This old-style function definition is not preceded by a prototype

文章目录Introwarning 及解决 截屏知其然&#xff0c;却不知其所以然Intro 在 Xcode 14 中随意写了几个C命令行程序&#xff0c;编译运行OK。 但是有以下两种报错&#xff1a; This old-style function definition is not preceded by a prototype This function declaration…

联诚发携手电影《流浪地球2》,让电影特效和场景全面升级!

一万五千年前&#xff0c;一根愈合的人类股骨&#xff0c;标志着人类文明的诞生&#xff1b;一万五千年后&#xff0c;当太阳系将不复存在&#xff0c;人类的团结与勇气将延续文明的火种&#xff01;新年第一部精彩绝伦的国产科幻大片&#xff0c;大家期待已久的《流浪地球2》终…

动态规划的优化

动态规划的优化 一、空间优化 说明 动态规划空间优化为滚动数组优化&#xff0c;即对于一个多维数组&#xff0c;转移时均是由上一阶段转移来的&#xff0c;则可以将这一维省略&#xff0c;以降低空间复杂度&#xff0c;但要注意转移时的顺序&#xff1b; 例题 0 - 1 背包…

基础算法--背包问题(01背包问题、完全背包问题、多重背包问题、分组背包问题)

文章目录前言01背包问题完全背包问题多重背包问题分组背包问题前言 背包问题&#xff1a;给我们 i 件物品&#xff0c;每件物品都有体积 vi 和权重 wi &#xff0c;给我们限制条件&#xff0c;让我们选择在背包的容量内&#xff0c;物品达到权重最大 01背包问题 01背包问题描…

KK集团再冲刺港交所上市:期内被罚款30万元,曾存在“二清”问题

时隔一年&#xff0c;KK集团再次在港交所递交上市申请。2023年1月20日&#xff0c;KK集团&#xff08;KK Group Company Holdings Limited&#xff09;向港交所提交上市申请。据贝多财经了解&#xff0c;KK集团曾于2021年11月4日在港交所递表&#xff0c;后已“失效”。 相较于…

LeetCode_单周赛_329

2544. 交替数字和 代码1 转成字符串&#xff0c;逐个判断 class Solution {public int alternateDigitSum(int n) {char[] s ("" n).toCharArray();int t 1;int ans 0;for (int i 0; i < s.length; i) {ans (s[i] - 0) * t;t -t;}return ans;} }代码2 一…

国内做SaaS软件的知名企业有哪些?

SaaS厂商还挺多挺杂的。具体要列举的话&#xff0c;还是按照分类来吧。 通用业务和垂直行业的SaaS 对使用方来说&#xff0c;一般分为业务通用型和垂直行业型。 通用型是可以服务所有企业的&#xff0c;比如CRM&#xff08;客户管理软件&#xff09;、HR软件、协同办公软件&a…

linux系统中利用QT实现语音识别项目的操作方法

大家好&#xff0c;今天主要和大家分享一下&#xff0c;如何使用linux系统上的语音识别项目的操作方法与实现。 目录 第一&#xff1a;语音识别基本简介 第二&#xff1a;语音识别产品申请账号 第三&#xff1a;具体代码实现 第一&#xff1a;语音识别基本简介 AI音箱对传统…

Java_Git:3. 远程仓库

目录 1 添加远程库 1.1 在github上创建仓库 1.2 ssh协议 1.2.1 什么是ssh? 1.2.2 基于密匙的安全验证 1.2.3 ssh密钥生成 ​​​​​​​​​​​​​​1.2.4 ssh密钥配置 1.3 同步到远程仓库 1.3.1 使用git bash 1.3.2 使用TortoiseGit同步 2 从远程仓库克隆 2.1 …

CSS颜色:RGB颜色/HEX颜色/HSL颜色(网页颜色完全总结)

目录 CSS 颜色名 CSS 背景色 实例 CSS 文本颜色 ​编辑 实例 CSS 边框颜色 实例 CSS 颜色值 实例 RGB 值 rgb(red, green, blue) 实例 实例 RGBA 值 rgba(red, green, blue, alpha) 实例 HEX 值 #rrggbb 实例 实例 HSL 值 hsla(hue, saturation, lightn…

autojs模仿QQ长按弹窗菜单

牙叔教程 简单易懂 分析弹框菜单 圆角列表, 类似grid箭头位于文字中间上(下)方需求分析 如果要写一个这样的教程, 我们需要做什么 写一个列表, 用来触发长按选项写一个弹窗菜单代码分析 列表怎么写, 先来一个最简单的布局代码 "nodejs ui"; require("rhin…

系统架构:分层架构

引子 系统在从0到1阶段时&#xff0c;为了可让产品快速上线&#xff0c;此时系统分层一般不是软件开发需要重点考虑的范畴&#xff0c;但是随着业务逐渐复杂 &#xff0c;大量代码纠缠耦合&#xff0c;此时会出现逻辑不清楚、模块相互依赖、扩展性差、改一处动全身的问题。 系…

基于双层共识控制的直流微电网优化调度(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️❤️&#x1f4a5;&#x1f4a5;&#x1f4a5; &#x1f389;作者研究&#xff1a;&#x1f3c5;&#x1f3c5;&#x1f3c5;本科计算机专业&#xff0c;研究生电气学硕…

14. python运算符

Python 语言支持以下类型的运算符 1. 算术运算符 、-、*、/、%、**、// **  返回x的y次幂 //  取整除 - 向下取接近商的整数(//得到的并不一定是整数类型的数&#xff0c;它与分母分子的数据类型有关系) print(7//2) print(7.0//2) print(7//2.0)2. 比较&#xff08;关系&…

进程概念——Linux

“技术是时间积淀出来的&#xff0c;你能速成的东西&#xff0c;别人也可以速成,所以需要耐心学习” 猛戳订阅&#x1f341;&#x1f341; &#x1f449;Linux操作系统详解&#x1f448; &#x1f341;&#x1f341; 这里是目录标题一、冯诺依曼结构为什么要存在内存&#xff1…