JVM在线分析-解决问题的工具一(jinfo,jmap,jstack)

news2024/11/25 0:47:51

1. jinfo

(base) PS C:\Users\zishi\Desktop> jinfo
Usage:
    jinfo <option> <pid>
       (to connect to a running process)

where <option> is one of:
    -flag <name>         to print the value of the named VM flag #输出对应名称的参数
    -flag [+|-]<name>    to enable or disable the named VM flag
    # 开启或者关闭对应名称的参数 只有被标记为 manageable 的参数才可以被动态修改
    -flag <name>=<value> to set the named VM flag to the given value  #设定对应名称的参数
    -flags               to print VM flags # 输出全部的参数
    -sysprops            to print Java system properties #输出系统属性
    <no option>          to print both VM flags and system properties 
    -? | -h | --help | -help to print this help message
(base) PS C:\Users\zishi> jinfo 9368
Java System Properties:
#Thu Nov 09 09:05:06 CST 2023
sun.desktop=windows
awt.toolkit=sun.awt.windows.WToolkit
java.specification.version=11
sun.cpu.isalist=amd64
sun.jnu.encoding=GBK
java.class.path=.\\quality-server.jar
java.vm.vendor=Oracle Corporation
sun.arch.data.model=64
user.variant=
catalina.useNaming=false
java.vendor.url=https\://openjdk.java.net/
。。。。略去
(base) PS C:\Users\zishi> jinfo  -sysprops 9368
Java System Properties:
#Thu Nov 09 09:07:07 CST 2023
sun.desktop=windows
awt.toolkit=sun.awt.windows.WToolkit
。。。。略去
(base) PS C:\Users\zishi> jinfo  -flags 9368
VM Flags:
-XX:CICompilerCount=4 
-XX:ConcGCThreads=3 
-XX:G1ConcRefinementThreads=10 
-XX:G1HeapRegionSize=2097152 
-XX:GCDrainStackTargetSize=64 
-XX:InitialHeapSize=534773760 
-XX:MarkStackSize=4194304 
-XX:MaxHeapSize=8524922880 
-XX:MaxNewSize=5114953728 
-XX:MinHeapDeltaBytes=2097152 
-XX:NonNMethodCodeHeapSize=5836300 
-XX:NonProfiledCodeHeapSize=122910970 
-XX:ProfiledCodeHeapSize=122910970 
-XX:ReservedCodeCacheSize=251658240 
-XX:+SegmentedCodeCache 
-XX:+UseCompressedClassPointers 
-XX:+UseCompressedOops 
-XX:+UseG1GC 
-XX:-UseLargePagesIndividualAllocation
(base) PS C:\Users\zishi> jinfo  -flag MaxHeapSize 9368
-XX:MaxHeapSize=8524922880
(base) PS C:\Users\zishi> jinfo  -flag MaxHeapSize=8524922883 9368
Exception in thread "main" com.sun.tools.attach.AttachOperationFailedException: flag 'MaxHeapSize' cannot be changed
        at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(VirtualMachineImpl.java:130)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:309)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.setFlag(HotSpotVirtualMachine.java:282)
        at jdk.jcmd/sun.tools.jinfo.JInfo.flag(JInfo.java:146)
        at jdk.jcmd/sun.tools.jinfo.JInfo.main(JInfo.java:127)

查看被标记为 manageable 的参数

$ java -XX:+PrintFlagsFinal -version | grep  manageable
     intx CMSAbortablePrecleanWaitMillis           = 100                                    {manageable} {default}
     intx CMSTriggerInterval                       = -1                                     {manageable} {default}
     intx CMSWaitDuration                          = 2000                                   {manageable} {default}
     bool HeapDumpAfterFullGC                      = false                                  {manageable} {default}
     bool HeapDumpBeforeFullGC                     = false                                  {manageable} {default}
     bool HeapDumpOnOutOfMemoryError               = false                                  {manageable} {default}
    ccstr HeapDumpPath                             =                                        {manageable} {default}
    uintx MaxHeapFreeRatio                         = 70                                     {manageable} {default}
    uintx MinHeapFreeRatio                         = 40                                     {manageable} {default}
     bool PrintClassHistogram                      = false                                  {manageable} {default}
     bool PrintConcurrentLocks                     = false                                  {manageable} {default}
java version "11.0.13" 2021-10-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)

在这里插入图片描述
修改参数的值

(base) PS C:\Users\zishi> jinfo  -flag MaxHeapFreeRatio 9368
-XX:MaxHeapFreeRatio=70
(base) PS C:\Users\zishi> jinfo  -flag MaxHeapFreeRatio=80 9368
(base) PS C:\Users\zishi> jinfo  -flag MaxHeapFreeRatio 9368
-XX:MaxHeapFreeRatio=80

开启参数:

(base) PS C:\Users\zishi> jinfo -flag HeapDumpBeforeFullGC 9368
-XX:-HeapDumpBeforeFullGC
(base) PS C:\Users\zishi> jinfo -flag +HeapDumpBeforeFullGC 9368
(base) PS C:\Users\zishi> jinfo -flag HeapDumpBeforeFullGC 9368
-XX:+HeapDumpBeforeFullGC

扩展
java -XX:+PrintFlagsInitial 查看所有 JVM 参数启动的初始值
java -XX:+PrintFlagsFinal 查看所有 JVM 参数的最终值
java -XX:+PrintCommandLineFlags 查看哪些已经被用户或者 JVM 设置过的详细的 XX 参数的名称和值

2. jmap

(base) PS C:\Users\zishi> jmap
Usage:
    jmap -clstats <pid>
        to connect to running process and print class loader statistics
    jmap -finalizerinfo <pid>
        to connect to running process and print information on objects awaiting finalization
    jmap -histo[:live] <pid>
        to connect to running process and print histogram of java object heap
        if the "live" suboption is specified, only count live objects
    jmap -dump:<dump-options> <pid>
        to connect to running process and dump java heap
    jmap -? -h --help
        to print this help message

    dump-options:
      live         dump only live objects; if not specified,
                   all objects in the heap are dumped.
      format=b     binary format
      file=<file>  dump heap to <file>

    Example: jmap -dump:live,format=b,file=heap.bin <pid>
$ jmap -clstats 9368 > a.txt
$ cat a.txt | head -n 10
Index Super InstBytes KlassBytes annotations    CpAll MethodCount Bytecodes MethodAll    ROAll    RWAll    Total ClassName
    1    -1  10510264        504           0        0           0         0         0       24      616      640 [B
    2  8286   5545320       1112           0     6816          47      1117     27912     6480    30104    36584 java.lang.reflect.Method
    3    18   4025232        616         128    14264         109      4576     71992    18640    69664    88304 java.lang.String
    4    18   2461504        592           0     1360           9       213      2720     1488     3520     5008 java.util.concurrent.ConcurrentHashMap$Node
    5    -1   2286832        504           0        0           0         0         0       24      616      640 [Ljava.lang.Object;
    6    -1   2075104        504           0        0           0         0         0       32      616      648 [Ljava.util.HashMap$Node;
    7    18   2013216        584           0     1384           7       149      1816     1152     2952     4104 java.util.HashMap$Node
    8     7   1977960        584           0      504           1        10       624      304     1640     1944 java.util.LinkedHashMap$Entry
    9    18   1720280        672           0    22112         139      5679     85040    24632    85104   109736 java.lang.Class

$ jmap -clstats 9368 | grep com.zishi.docuvate.exception
 4077    18        16        552          56     2568           6       282      1576     1448     3504     4952 com.zishi.docuvate.exception.GlobalExceptionHandler
 7429  7856         0        624           0      440           3        54       568      464     1368     1832 com.zishi.docuvate.exception.BadRequestException
 7430  7856         0        640           0      624           8       105      1472     1072     1952     3024 com.zishi.docuvate.exception.GlobalException

说明:

Index
Super
InstBytes
KlassBytes
annotations
CpAll
MethodCount
Bytecodes
MethodAll
ROAll
RWAll
Total
ClassName: 类的完全限定名

(base) PS C:\Users\zishi> jmap -histo 23152
 num     #instances         #bytes  class name (module)
-------------------------------------------------------
   1:       1164144      152211432  [B (java.base@11.0.13)
   2:        147373       44824568  [I (java.base@11.0.13)
   3:        694738       16673712  java.lang.String (java.base@11.0.13)
   4:        601819       12621496  [Ljava.lang.Class; (java.base@11.0.13)
   5:        107422        9453136  java.lang.reflect.Method (java.base@11.0.13)
   6:        113936        7291904  java.net.URL (java.base@11.0.13)
   7:        141772        4536704  org.springframework.boot.loader.jar.StringSequence
   8:         75593        4434728  [Ljava.lang.Object; (java.base@11.0.13)
   9:        178622        4286928  java.lang.StringBuilder (java.base@11.0.13)
  10:        102026        4081040  org.springframework.core.annotation.TypeMappedAnnotations
  11:         36093        2871384  [Ljava.util.HashMap$Node; (java.base@11.0.13)
  12:         88017        2816544  java.util.concurrent.ConcurrentHashMap$Node (java.base@11.0.13)
  13:         84459        2702688  org.springframework.core.annotation.TypeMappedAnnotations$MergedAnnotationFinder
  14:         82805        2649760  java.util.HashMap$Node (java.base@11.0.13)
  15:         64740        2589600  java.util.LinkedHashMap$Entry (java.base@11.0.13)
  16:         49166        2359968  java.util.HashMap (java.base@11.0.13)
  17:         92807        2227368  org.springframework.boot.loader.jar.JarURLConnection$JarEntryName
  18:         12370        2153808  [C (java.base@11.0.13)

说明:

#instances:对象数量
#bytes: 占用内存大小(单位:字节)
class name (module): 类的完全限定名

3. jstack

(base) PS C:\Users\zishi> jstack
Usage:
    jstack [-l][-e] <pid>
        (to connect to running process)

Options:
    -l  long listing. Prints additional information about locks
    -e  extended listing. Prints additional information about threads
    -? -h --help -help to print this help message

代码示例:

/**
 * 当DeadLock类的对象flag==1时(td1),先锁定o1,睡眠500毫秒
 * 而td1在睡眠的时候另一个flag==0的对象(td2)线程启动,先锁定o2,睡眠500毫秒
 * td1睡眠结束后需要锁定o2才能继续执行,而此时o2已被td2锁定;
 * td2睡眠结束后需要锁定o1才能继续执行,而此时o1已被td1锁定;
 * td1、td2相互等待,都需要得到对方锁定的资源才能继续执行,从而死锁。
 */
public class DeadLockTest implements Runnable{

    public int flag = 1;
    
    //静态对象是类的所有对象共享的
    private static Object o1 = new Object(), o2 = new Object();
    @Override
    public void run() {
        System.out.println("flag=" + flag);
        if (flag == 1) {
            synchronized (o1) {
                try {
                    Thread.sleep(500);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                synchronized (o2) {
                    System.out.println("1");
                }
            }
        }
        if (flag == 0) {
            synchronized (o2) {
                try {
                    Thread.sleep(500);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                synchronized (o1) {
                    System.out.println("0");
                }
            }
        }
    }

    public static void main(String[] args) {
        DeadLockTest td1 = new DeadLockTest();
        DeadLockTest td2 = new DeadLockTest();
        td1.flag = 1;
        td2.flag = 0;
        //td1,td2都处于可执行状态,但JVM线程调度先执行哪个线程是不确定的。
        //td2的run()可能在td1的run()之前运行
        new Thread(td1).start();
        new Thread(td2).start();
    }
}

编译运行,执行jstack

(base) PS C:\Users\zishi> jstack 21744
2023-11-09 18:47:14
Full thread dump Java HotSpot(TM) 64-Bit Server VM (11.0.13+10-LTS-370 mixed mode):

Threads class SMR info:
_java_thread_list=0x000001d91fca51a0, length=12, elements={
0x000001d91fa90800, 0x000001d91fab5800, 0x000001d91fb2b800, 0x000001d91fb2c800,
0x000001d91fb2e000, 0x000001d91fb31000, 0x000001d91fb32800, 0x000001d91fb35800,
0x000001d91fcb6800, 0x000001d91fcbc000, 0x000001d91fcbc800, 0x000001d972982000
}

"Reference Handler" #2 daemon prio=10 os_prio=2 cpu=0.00ms elapsed=18.72s tid=0x000001d91fa90800 nid=0x2aac waiting on condition  [0x000000aacf8ff000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.ref.Reference.waitForReferencePendingList(java.base@11.0.13/Native Method)
        at java.lang.ref.Reference.processPendingReferences(java.base@11.0.13/Reference.java:241)
        at java.lang.ref.Reference$ReferenceHandler.run(java.base@11.0.13/Reference.java:213)

"Finalizer" #3 daemon prio=8 os_prio=1 cpu=0.00ms elapsed=18.72s tid=0x000001d91fab5800 nid=0x2224 in Object.wait()  [0x000000aacf9fe000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(java.base@11.0.13/Native Method)
        - waiting on <0x0000000623a08fa8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(java.base@11.0.13/ReferenceQueue.java:155)
        - waiting to re-lock in wait() <0x0000000623a08fa8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(java.base@11.0.13/ReferenceQueue.java:176)
        at java.lang.ref.Finalizer$FinalizerThread.run(java.base@11.0.13/Finalizer.java:170)

"Signal Dispatcher" #4 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=18.70s tid=0x000001d91fb2b800 nid=0x3bcc runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Attach Listener" #5 daemon prio=5 os_prio=2 cpu=0.00ms elapsed=18.70s tid=0x000001d91fb2c800 nid=0x3740 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" #6 daemon prio=9 os_prio=0 cpu=0.00ms elapsed=18.70s tid=0x000001d91fb2e000 nid=0xd0c runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #7 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=18.70s tid=0x000001d91fb31000 nid=0x1620 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"C1 CompilerThread0" #10 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=18.70s tid=0x000001d91fb32800 nid=0x133c waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"Sweeper thread" #11 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=18.70s tid=0x000001d91fb35800 nid=0x1368 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Common-Cleaner" #12 daemon prio=8 os_prio=1 cpu=0.00ms elapsed=18.67s tid=0x000001d91fcb6800 nid=0x1df8 in Object.wait()  [0x000000aad01fe000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(java.base@11.0.13/Native Method)
        - waiting on <0x0000000623bf37f8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(java.base@11.0.13/ReferenceQueue.java:155)
        - waiting to re-lock in wait() <0x0000000623bf37f8> (a java.lang.ref.ReferenceQueue$Lock)
        at jdk.internal.ref.CleanerImpl.run(java.base@11.0.13/CleanerImpl.java:148)
        at java.lang.Thread.run(java.base@11.0.13/Thread.java:834)
        at jdk.internal.misc.InnocuousThread.run(java.base@11.0.13/InnocuousThread.java:134)

"Thread-0" #13 prio=5 os_prio=0 cpu=0.00ms elapsed=18.67s tid=0x000001d91fcbc000 nid=0x39d4 waiting for monitor entry  [0x000000aad02ff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at DeadLockTest.run(DeadLockTest.java:25)
        - waiting to lock <0x0000000623bf7078> (a java.lang.Object)
        - locked <0x0000000623bf7068> (a java.lang.Object)
        at java.lang.Thread.run(java.base@11.0.13/Thread.java:834)

"Thread-1" #14 prio=5 os_prio=0 cpu=0.00ms elapsed=18.67s tid=0x000001d91fcbc800 nid=0x7f8 waiting for monitor entry  [0x000000aad03ff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at DeadLockTest.run(DeadLockTest.java:37)
        - waiting to lock <0x0000000623bf7068> (a java.lang.Object)
        - locked <0x0000000623bf7078> (a java.lang.Object)
        at java.lang.Thread.run(java.base@11.0.13/Thread.java:834)

"DestroyJavaVM" #15 prio=5 os_prio=0 cpu=15.63ms elapsed=18.67s tid=0x000001d972982000 nid=0x5744 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"VM Thread" os_prio=2 cpu=0.00ms elapsed=18.73s tid=0x000001d91fa8f800 nid=0x222c runnable

"GC Thread#0" os_prio=2 cpu=0.00ms elapsed=18.77s tid=0x000001d972996800 nid=0x5144 runnable

"G1 Main Marker" os_prio=2 cpu=0.00ms elapsed=18.77s tid=0x000001d972a17800 nid=0x4180 runnable

"G1 Conc#0" os_prio=2 cpu=0.00ms elapsed=18.77s tid=0x000001d972a19000 nid=0x3380 runnable

"G1 Refine#0" os_prio=2 cpu=0.00ms elapsed=18.75s tid=0x000001d97fde5800 nid=0x2ba4 runnable

"G1 Young RemSet Sampling" os_prio=2 cpu=0.00ms elapsed=18.75s tid=0x000001d97fde6800 nid=0x2f8c runnable
"VM Periodic Task Thread" os_prio=2 cpu=0.00ms elapsed=18.67s tid=0x000001d91fcb6000 nid=0x2990 waiting on condition

JNI global refs: 6, weak refs: 0


Found one Java-level deadlock:
=============================
"Thread-0":
  waiting to lock monitor 0x000001d91fabff80 (object 0x0000000623bf7078, a java.lang.Object),
  which is held by "Thread-1"
"Thread-1":
  waiting to lock monitor 0x000001d91fabcc80 (object 0x0000000623bf7068, a java.lang.Object),
  which is held by "Thread-0"

Java stack information for the threads listed above:
===================================================
"Thread-0":
        at DeadLockTest.run(DeadLockTest.java:25)
        - waiting to lock <0x0000000623bf7078> (a java.lang.Object)
        - locked <0x0000000623bf7068> (a java.lang.Object)
        at java.lang.Thread.run(java.base@11.0.13/Thread.java:834)
"Thread-1":
        at DeadLockTest.run(DeadLockTest.java:37)
        - waiting to lock <0x0000000623bf7068> (a java.lang.Object)
        - locked <0x0000000623bf7078> (a java.lang.Object)
        at java.lang.Thread.run(java.base@11.0.13/Thread.java:834)

Found 1 deadlock.

说明:

Thread-1:线程名
prio:优先级
os_prio:操作系统级别的线程优先级
tid:线程id
nid:线程对应本地线程id
java.lang.Thread.State:线程状态

可以看到有一个 dead lock
Found one Java-level deadlock:
jstack还帮我们打印了死锁产生的原因
打印了死锁产生的原因之外,还帮我们定位到了java的代码行数:

Found one Java-level deadlock:
=============================
"Thread-0":
  waiting to lock monitor 0x000001d91fabff80 (object 0x0000000623bf7078, a java.lang.Object),
  which is held by "Thread-1"
"Thread-1":
  waiting to lock monitor 0x000001d91fabcc80 (object 0x0000000623bf7068, a java.lang.Object),
  which is held by "Thread-0"

Java stack information for the threads listed above:
===================================================
"Thread-0":
        at DeadLockTest.run(DeadLockTest.java:25)
        - waiting to lock <0x0000000623bf7078> (a java.lang.Object)
        - locked <0x0000000623bf7068> (a java.lang.Object)
        at java.lang.Thread.run(java.base@11.0.13/Thread.java:834)
"Thread-1":
        at DeadLockTest.run(DeadLockTest.java:37)
        - waiting to lock <0x0000000623bf7068> (a java.lang.Object)
        - locked <0x0000000623bf7078> (a java.lang.Object)
        at java.lang.Thread.run(java.base@11.0.13/Thread.java:834)

Found 1 deadlock.

参考:
https://juejin.cn/post/6957903936657293319#heading-3

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

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

相关文章

v-calendar 日历组件使用自定义提示内容

目录 0.介绍 1.安装v-calendar 2.页面使用 3.使用插槽实现待办数量的标记 0.介绍 最近项目中用到了日历插件&#xff0c;需要统计每天的任务数量&#xff0c;类似elementui的badge组件&#xff0c;待办任务数量 大概最后的效果如下图所示&#xff0c;右上角把代办任务数量…

php 二分查询算法实现

原理&#xff1a;二分查找算法&#xff08;Binary Search&#xff09;是一种针对有序数组的查找算法。它的原理是通过将查找区间逐渐缩小一半来快速定位要查找的目标值。 应用场景&#xff1a; 数据库或文件系统索引查找&#xff1a;在数据库或文件系统中&#xff0c;索引是有…

基于springboot 停车场管理系统-计算机毕设 附源码 39315

spring boot停车场管理系统的设计与实现 摘 要 科技进步的飞速发展引起人们日常生活的巨大变化&#xff0c;电子信息技术的飞速发展使得电子信息技术的各个领域的应用水平得到普及和应用。信息时代的到来已成为不可阻挡的时尚潮流&#xff0c;人类发展的历史正进入一个新时代。…

【C++数据结构】顺序存储结构的抽象实现

文章目录 前言一、目标二、SeqList实现要点三、SeqList函数实现3.1 get函数3.2 set函数3.3 insert函数带2个参数的insert带一个参数的insert 3.4 remove函数3.5 clear函数3.6 下标运算符重载函数无const版本const版本 3.7 length函数 总结 前言 当谈到C数据结构时&#xff0c;…

97 只出现一次的数字

只出现一次的数字 题解1 异或的应用&#xff08;判断出现次数是奇偶&#xff09; 给你一个 非空 整数数组 nums &#xff0c;除了某个元素只出现一次以外&#xff0c;其余每个元素均出现两次。找出那个只出现了一次的元素。 你必须设计并实现线性时间复杂度的算法来解决此问题…

PCIe寄存器之二

关键字索引&#xff1a; CAP_PM 对应&#xff1a;Capabilities: [c0] Power Management CAP_MSI 对应&#xff1a;Capabilities: [c8] MSI CAP_MSIX对应&#xff1a;Capabilities: [e0] MSI-X CAP_EXP 对应&#xff1a;Capabilities: [70] Express (v2) Endpoint 以上 [] 内的…

开设自己的网站系类03安装数据库(centos版)

编者买了一个服务器打算自己构建一个网站&#xff0c;用于记录生活。网站大概算是一个个人博客吧。记录创建过程的一些步骤。 前面已经讲过配置服务器的程序运行环境 网站运行还需要数据库&#xff0c;本篇文章则是安装数据库的内容。 卸载mariadb 查看是否有安装 mariadb&…

【Python】数据分析案例:世界杯数据可视化

文章目录 前期数据准备导入数据 分析&#xff1a;世界杯中各队赢得的比赛数分析&#xff1a;先打或后打的比赛获胜次数分析&#xff1a;世界杯中的抛硬币决策分析&#xff1a;2022年T20世界杯的最高得分者分析&#xff1a;世界杯比赛最佳球员奖分析&#xff1a;最适合先击球或追…

【C语言基础】近期所学到的函数以及关键字(函数memset、scanf、关键字staric、 inline、volatile)

&#x1f4e2;&#xff1a;如果你也对机器人、人工智能感兴趣&#xff0c;看来我们志同道合✨ &#x1f4e2;&#xff1a;不妨浏览一下我的博客主页【https://blog.csdn.net/weixin_51244852】 &#x1f4e2;&#xff1a;文章若有幸对你有帮助&#xff0c;可点赞 &#x1f44d;…

python核心编程速记【笔记迁移】

笔记速记 1.python非常注重缩进&#xff0c;这是它的显著特征之一。 2.import相当于头文件声明模块。 3.利用type函数 type(a)可以查看当前变量类型。 isinstance可以比较两个数据类型并返回一个布尔值。 4.这里面的可直接使用and和or作为一个函数 5.python的算法比较贴合…

如何改善食品饮料包装生产企业的OEE?

食品饮料这类商品在我们的日常生活中十分常见&#xff0c;它们存在于各类商店、超市或路边的小店里。而食品饮料的包装是吸引人们购买该产品的一个重要因素。为了在这个市场中脱颖而出并提高盈利能力&#xff0c;企业需要关注设备的综合效率&#xff0c;即OEE&#xff08;Overa…

SpringBoot测试类启动web环境-上篇

1.坐标修改 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency> 2.测试类测试 说明&#xff1a;SpringBootTest()中的webEnvironment值的说明&#xff1b; 2.1不启…

vue项目js原生属性IntersectionObserver实现图片懒加载

vue项目js原生属性IntersectionObserver实现图片懒加载 IntersectionObserver 使用js原生属性IntersectionObserver实现观察img元素是否处于游览器视口中 懒加载原理&#xff1a;给img设置一个默认url图片&#xff0c;观察图片处于视口内以后&#xff0c;动态改变img的url为自己…

机组 CPU

控制器&#xff1a;协调并控制计算机各部件执行程序的指令序列&#xff0c;其基本功能是取指令、分析指令和执行指令 功能 CPU 必须具有控制程序的顺序执行&#xff08;指令控制&#xff09;、产生完成每条指令所需的控制命令&#xff08;操作控制&#xff09;、对各种操作加…

原神游戏干货分享:探索璃月的宝箱秘密,提高游戏资源获取效率!

《原神》是一款备受玩家喜爱的开放世界冒险游戏&#xff0c;而在游戏中获取资源是提升角色实力的重要途径。在这篇实用干货分享中&#xff0c;我们将介绍一些探索璃月地区的宝箱秘密&#xff0c;帮助你提高游戏资源获取的效率。 首先&#xff0c;璃月地区的宝箱分为普通宝箱和精…

Leetcode刷题详解—— 找出所有子集的异或总和再求和

1. 题目链接&#xff1a;1863. 找出所有子集的异或总和再求和 2. 题目描述&#xff1a; 一个数组的 异或总和 定义为数组中所有元素按位 XOR 的结果&#xff1b;如果数组为 空 &#xff0c;则异或总和为 0 。 例如&#xff0c;数组 [2,5,6] 的 异或总和 为 2 XOR 5 XOR 6 1 。…

基于QT使用OpenGL,加载obj模型,进行鼠标交互

目录 功能分析&#xff08;需求分析&#xff09;技术点分析OpenGL立即渲染模式可编程渲染管线模式 QOpenGLWidget派生类 glwidget逻辑glwidget.hglwidget.cpp 鼠标交互功能obj格式介绍 效果bunnyCayman_GT 功能分析&#xff08;需求分析&#xff09; 基于QT平台&#xff0c;使…

【被面试官吊打系列】啥,你没说面试要考智力题呀 (上) ?

你好&#xff0c;我是安然无虞。 文章目录 1. 二进制问题分金条问题毒药问题 2. 先手必胜问题轮流拿石子抢30的必胜策略Nim游戏 3. 水桶问题5L和6L的水桶怎么量出3L的水&#xff1f;3L和5L的水桶怎么量出4L的水&#xff1f;一个装了10L水的桶&#xff0c;一个7L的空桶还有一个…

2.【自动驾驶与机器人中的SLAM技术】左乘模型推导ESKF

目录 1. 证明题 证明&#xff1a;若某个高斯随机变量为零均值&#xff0c;协方差为对角线矩阵且大小相同&#xff08;各向同性&#xff09;&#xff0c;那么在乘任意旋转矩阵以后&#xff0c;其均值仍为零&#xff0c;且协方差不变&#xff1b; 2. 代码实现运动方程将F矩阵…

FreeRTOS_内存管理

目录 1. 内存管理简介 2. 内存碎片 3. heap_1 内存分配方法 3.1 分配方法简介 4. heap_2 内存分配方法 4.1 分配方法简介 4.2 内存块详解 5. heap_4 内存分配方法 6. FreeRTOS 内存管理实验 6.1 实验程序 内存管理是一个系统基本组成部分&#xff0c;FreeRTOS 中大量…