CN115220990A - Multi-core system program flow monitoring method, device, equipment and storage medium - Google Patents

Multi-core system program flow monitoring method, device, equipment and storage medium Download PDF

Info

Publication number
CN115220990A
CN115220990A CN202111502127.XA CN202111502127A CN115220990A CN 115220990 A CN115220990 A CN 115220990A CN 202111502127 A CN202111502127 A CN 202111502127A CN 115220990 A CN115220990 A CN 115220990A
Authority
CN
China
Prior art keywords
program
monitoring
sub
subprogram
execution sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111502127.XA
Other languages
Chinese (zh)
Other versions
CN115220990B (en
Inventor
王志伟
马桂谦
胡继浩
连焕雄
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Automobile Group Co Ltd
Original Assignee
Guangzhou Automobile Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Automobile Group Co Ltd filed Critical Guangzhou Automobile Group Co Ltd
Priority to CN202111502127.XA priority Critical patent/CN115220990B/en
Priority claimed from CN202111502127.XA external-priority patent/CN115220990B/en
Publication of CN115220990A publication Critical patent/CN115220990A/en
Application granted granted Critical
Publication of CN115220990B publication Critical patent/CN115220990B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Abstract

The invention discloses a multi-core system program flow monitoring method, which comprises the following steps: allocating a monitor program in each kernel in the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; establishing an association relationship between the monitoring program in each kernel and the subprograms in the rest of the kernels; when the execution of the plurality of subprograms is finished, acquiring a subprogram execution sequence of the subprograms monitored by the monitoring program; and when the sub execution sequence of any sub program does not match the target execution sequence, judging that the program flow of the multi-core system has an exception. The invention also discloses a device, equipment and storage medium for monitoring the program flow of the multi-core system. According to the embodiment of the invention, the monitoring programs are arranged in the plurality of kernels to monitor other subprograms outside the kernels, so that the situation that the subprograms in the kernels in which the monitoring programs are monitored are trapped in endless loop and cannot be executed is avoided, and the monitoring coverage is improved.

Description

Multi-core system program flow monitoring method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for monitoring program streams of a multi-core system.
Background
With the explosive growth of information, in order to process information in time and increase the operating speed of a single-core chip, a computer system needs to process more and more information in the same time, but the single-core chip generates excessive heat when a large number of programs are rapidly operated, thereby causing the performance of the chip to be reduced. Therefore, in order to better adapt to the explosive growth of information, the prior art provides a multi-core technology, a program to be operated is divided into a plurality of subprograms, and the application of the multi-core technology enables the subprograms to be operated and processed in different cores, so that the operation pressure of each core is reduced, and the overheating of the cores is avoided.
In the running process of the multi-core technology, the implementation of a certain function is realized by combining a series of subprograms distributed on the same core or different cores, and when an error occurs or the subprograms are not called, the corresponding functions of the subprograms are abnormal, so that the program flow in the multi-core system needs to be monitored. In the prior art, all subprograms are monitored by setting a monitoring program on a kernel, but when the subprogram of the kernel where the monitoring program is located falls into an endless loop, the monitoring program may not be executed, and thus it is impossible to monitor that the program runs abnormally.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, a device, and a storage medium for monitoring program flow of a multi-core system, which are capable of setting a monitoring program in a plurality of cores to monitor other subroutines outside the core where the monitoring program is located, so as to avoid a situation that the monitoring program cannot be executed when monitoring the subroutines inside the core where the monitoring program is located in a dead loop, and improve monitoring coverage.
In order to achieve the above object, an embodiment of the present invention provides a method for monitoring program flows of a multi-core system, including:
allocating a monitor program in each kernel in the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
establishing an association relationship between the monitor program in each kernel and the subprograms in the rest kernels;
when the plurality of subprograms are executed completely, acquiring a subprogram execution sequence monitored by the monitoring program;
and when the sub execution sequence of any subprogram does not match with the target execution sequence, judging that the program flow of the multi-core system has an exception.
As an improvement of the above scheme, before each core in the multi-core system is allocated with a monitor, the method further includes:
distributing subprogram IDs to the plurality of subprograms according to the target execution sequence;
a kernel ID is assigned to the kernel.
As an improvement of the above scheme, the establishing an association relationship between the monitor program in each core and the subprograms in the other cores specifically includes:
allocating a monitor ID to the monitor;
establishing an association relation between the kernel ID and a monitor ID of a monitor in the kernel of the kernel;
establishing an association relation between the kernel ID and the subprogram ID of the subprogram in the kernel of the kernel;
and establishing an association relationship between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
As an improvement of the above scheme, the establishing an association relationship between the monitor ID corresponding to each core ID and the subprogram IDs corresponding to the other core IDs specifically includes:
setting a detection point in each subprogram, and distributing a detection point ID for the detection point;
establishing an association relation between the subprogram ID and the detection point ID of the detection point in the subprogram;
and establishing an association relationship between the monitoring program ID and a detection point ID corresponding to the subprogram ID according to the association relationship between the monitoring program ID and the subprogram ID.
As an improvement of the above scheme, the acquiring a sub-execution sequence of the sub-program monitored by the monitoring program specifically includes:
acquiring a sub-execution sequence of the detection points detected by the monitoring program;
and generating a subprogram execution sequence according to the subprogram execution sequence of the detection points based on the incidence relation between the subprogram ID and the detection point ID.
As an improvement of the above scheme, the method further comprises the following steps: and when the sub execution sequence of all the subprograms is matched with the target execution sequence, judging that the program flow is normal.
In order to achieve the above object, an embodiment of the present invention further provides a device for monitoring program flow of a multi-core system, including:
the monitoring program distribution module is used for distributing a monitoring program in each kernel in the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
the relation establishing module is used for establishing an association relation between the monitoring program in each kernel and the subprograms in the rest kernels;
a sub-execution sequence monitoring module, configured to, when all of the plurality of sub-programs are executed, obtain a sub-execution sequence of the sub-program monitored by the monitoring program;
and the program flow judging module is used for judging that the program flow of the multi-core system has an exception when the sub-execution sequence of any subprogram is not matched with the target execution sequence.
As an improvement of the above solution, the program flow determination module is further configured to determine that the program flow is normal when the sub-execution orders of all the sub-programs match the target execution order.
In order to achieve the above object, an embodiment of the present invention further provides a multicore system program flow monitoring apparatus, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where when the processor executes the computer program, the multicore system program flow monitoring method according to any of the above embodiments is implemented.
In order to achieve the above object, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, a device on which the computer-readable storage medium is located is controlled to execute the apparatus for monitoring a program flow of a multi-core system according to any of the above embodiments.
Compared with the prior art, the method, the device, the equipment and the storage medium for monitoring the program flow of the multi-core system disclosed by the embodiment of the invention have the advantages that the monitor program is distributed to each core of the multi-core system, the association relation between the monitor program in each core and the subprograms in the rest cores is established, and the sub-execution sequence of the subprograms monitored by the monitor program is obtained when the execution of the plurality of subprograms is finished; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; and when the sub execution sequence of any subprogram does not match with the target execution sequence, judging that the program flow of the multi-core system has an exception. Therefore, the monitoring programs can be arranged in the plurality of kernels and used for monitoring other subprograms outside the kernels, the situation that the monitoring programs cannot be executed when the subprograms in the kernels where the monitoring programs are located are in endless loop is avoided, and monitoring coverage is improved.
Drawings
Fig. 1 is a flowchart of a program flow monitoring method for a multi-core system according to an embodiment of the present invention;
FIG. 2 is a flowchart of another method for monitoring program flows in a multi-core system according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a multi-core system program flow monitoring apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device for monitoring program flow of a multi-core system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, it is a flowchart of a method for monitoring program flows of a multi-core system according to an embodiment of the present invention, where the method for monitoring program flows of a multi-core system includes:
s11, distributing a monitoring program in each kernel of the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
s12, establishing an association relationship between the monitoring program in each kernel and the subprograms in the rest kernels;
s13, when the plurality of subprograms are executed completely, acquiring a subprogram execution sequence monitored by the monitoring program;
s14, when the sub-execution sequence of any subprogram is not matched with the target execution sequence, judging that the program flow of the multi-core system has an abnormality.
In step S11, for example, in the multi-core system, a monitoring program is allocated to each core in response to the monitoring instruction, so as to monitor an execution sequence of a plurality of subroutines corresponding to a specific function; the monitoring instruction may be automatically generated after the multi-core system is powered on, that is, the monitoring program is allocated immediately when the multi-core system is powered on, or the monitoring instruction may be a specific function starting instruction input by a user, that is, when an instruction for starting a specific function is received, the monitoring program is allocated to each core, which is not limited herein; the specific function may be a music playing function or a video playing function, and is not limited herein; the monitoring program may be pre-stored in the local memory or the cloud server, and when receiving the monitoring instruction, the monitoring program is directly obtained from the local server or downloaded from the cloud server through networking, which is not limited herein.
Before step S12, a plurality of subprograms corresponding to the specific functions are called by responding to a specific function starting instruction input by a user, and the subprograms are distributed into a kernel; the specific function starting instruction may be input by a keyboard, a mouse, a touch screen, or voice, and is not limited herein.
In step S12, it should be noted that the monitoring program does not monitor the sub-program in the kernel where the monitoring program is located, but is used for monitoring all the sub-programs in the remaining kernels, so as to avoid the situation that the monitoring program cannot be executed when the monitoring program monitors the dead loop of the sub-program in the kernel where the monitoring program is located.
In step S13, for example, based on the association relationship between the monitoring program and the subprogram, the monitoring program is used to monitor the execution process of the subprogram, when a certain subprogram is executed, the monitoring program is used to record the running subprogram, and after all the subprograms are executed, the subprogram execution sequence of the subprograms associated with the monitoring program is obtained.
In step S14, as an example, a target sub-execution order of the sub-program associated with the monitoring program may be obtained according to a preset target execution order corresponding to the specific function and the sub-program associated with the monitoring program; and comparing the sub-execution sequence of the subprogram monitored by all the monitoring programs with the target sub-execution sequence of the subprogram associated with the monitoring programs, and judging that the program flow of the multi-core system is abnormal as long as one comparison result is not matched.
In this embodiment, a monitor program is allocated to each core of the multi-core system, and an association relationship between the monitor program in each core and the subprograms in the remaining cores is established, so that when all the subprograms are executed, a subprogram execution sequence monitored by the monitor program is obtained; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; and when the sub execution sequence of any subprogram does not match with the target execution sequence, judging that the program flow of the multi-core system has an exception. Therefore, the monitoring program is arranged in the cores and used for monitoring other subprograms outside the cores, so that the situation that the monitoring program cannot be executed when monitoring the subprograms inside the cores where the monitoring program is located in a dead loop is avoided, and the monitoring coverage is improved.
In an embodiment, before allocating a monitor program in each core in the multi-core system in step S11, the method further includes:
distributing subprogram IDs to the plurality of subprograms according to the target execution sequence;
a kernel ID is assigned to the kernel.
It should be noted that, because the monitor program of each core needs to establish an association relationship with the subprograms in the other cores, the cores and the subprograms need to be assigned IDs for the subsequent monitor program to determine the corresponding monitoring object.
Illustratively, assume that a specific function a includes three subroutines S1, S2, and S3, where S1, S2, and S3 are subroutine IDs assigned to the three subroutines in a preset target execution order, S1 is the first subroutine to be executed, and S3 is the last subroutine to be executed. Assume that there are three cores, numbered CPU1, CPU2, and CPU3, respectively.
It should be noted that ID assignment of the sub-program is not limited to the ascending order numbering according to the target execution order, may be the descending order numbering according to the target execution order, or may be other numbering forms, and is not limited herein.
In an embodiment, the establishing, in step S12, an association relationship between the monitor program in each core and the subprograms in the remaining cores specifically includes:
allocating a monitoring program ID to the monitoring program;
establishing an association relation between the kernel ID and a monitor ID of a monitor in the kernel of the kernel;
establishing an association relation between the kernel ID and the subprogram ID of the subprogram in the kernel of the kernel;
and establishing an association relationship between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
It should be noted that, in order to enable the monitor in each core to monitor the subroutines in the remaining cores, the monitor ID is allocated to the monitor, and after one monitor is allocated to each core, the association between the core and the monitor is realized by establishing the one-to-one association relationship between the core ID and the monitor ID.
Illustratively, assume there are three cores, numbered CPU1, CPU2, and CPU3, respectively, and assume that a particular function a includes three subroutines S1, S2, and S3, where S1 is assigned to CPU1, S2 is assigned to CPU2, and S3 is assigned to CPU3. Each kernel is distributed with a monitoring program, the number of the kernel where the monitoring program is located is referred to, and the monitoring program is numbered, namely the monitoring program in the CPU1 is distributed with an ID M1, the monitoring program in the CPU2 is distributed with an ID M2, and the monitoring program in the CPU3 is distributed with an ID M3; respectively establishing one-to-one corresponding incidence relations of CPU1 and M1, CPU2 and M2, and CPU3 and M3; respectively establishing the association relations of S1 in the CPU1 and the CPU1, S2 in the CPU2 and the CPU3 in the CPU3 and the CPU 2; according to the one-to-one association relationship between the CPU1 and the M1, the CPU2 and the M2, and the CPU3 and the M3, and the association relationship between the CPU1 and the S1, the CPU2 and the S2, and the CPU3 and the S3, the association between the M1 and the S2 and the S3 is established, the association between the M2 and the S1 and the S3 is established, so that the purposes of monitoring the S2 and the S3 by the M1, monitoring the S1 and the S3 by the M2, and monitoring the S1 and the S2 by the M3 are achieved.
It should be noted that the number of kernels, the number of subroutines, and the number of monitoring programs are not limited to the above specific settings; the allocation of the monitor program IDs of the monitor programs is not limited to the allocation rule, and in practical application, it is only necessary to ensure that the monitor program IDs of the monitor programs are different.
In one embodiment, the establishing an association relationship between the monitor ID corresponding to each core ID and the subprogram IDs corresponding to the other core IDs specifically includes:
setting a detection point in each subprogram, and distributing a detection point ID for the detection point;
establishing an association relation between the subprogram ID and the detection point ID of the detection point in the subprogram;
and establishing an association relationship between the monitoring program ID and a detection point ID corresponding to the subprogram ID according to the association relationship between the monitoring program ID and the subprogram ID.
It is worth to be noted that the detection points required by the monitoring program are placed in the corresponding subprogram, and the detection of the execution sequence of the subprogram is realized by monitoring the detection points.
For example, assuming that there are three monitoring programs M1, M2 and M3, the specific function a includes three subroutines S1, S2 and S3, M1 is associated with S2 and S3, M2 is associated with S1 and S3, and M3 is associated with S1 and S2; at S1, at set detection point CP1, at S2, at set detection point CP2, at S3, at set detection point CP3, and respectively establishing the association relationship between S1 and CP1, S2 and CP2, S3 and CP3, and further establishing the association relationship between M1 and CP2, CP3, M2 and CP1, CP3, M3 and CP1, CP 2.
In an embodiment, the obtaining of the sub-execution sequence of the sub-program monitored by the monitoring program specifically includes:
acquiring a sub-execution sequence of the detection points detected by the monitoring program;
and generating a subprogram execution sequence according to the subprogram execution sequence of the detection points based on the incidence relation between the subprogram ID and the detection point ID.
Specifically, when the subprogram is executed to a detection point arranged on the subprogram, the corresponding monitoring program records the detection point ID of the detection point, when all the subprograms are executed, the subprogram execution sequence of the detection point is obtained, and the subprogram execution sequence of the subprogram is obtained by combining the association relationship between the subprogram ID and the detection point ID.
For example, assume that there are subroutines S1, S2, S3, and S4, detection points CP1, CP2, CP3, and CP4, and monitoring routines M1, M2, M3, and M4; wherein, S1 is associated with CP1, S2 is associated with CP2, S3 is associated with CP3, and S4 is associated with CP 4; m1 is associated with CP2, CP3, CP4, M2 is associated with CP1, CP3, CP4, M3 is associated with CP1, CP2, CP4, M4 is associated with CP1, CP2, CP3. After the actual execution of the subroutine is completed, acquiring a sub-execution order of the detection point detected by M1 CP2 → CP3 → CP4, a sub-execution order of the detection point detected by M2 CP1 → CP3 → CP4, a sub-execution order of the detection point detected by M3 CP1 → CP2 → CP4, a sub-execution order of the detection point detected by M4 CP1 → CP2 → CP3; the sub-execution order of the detection points is converted into the sub-execution order of the sub-program, resulting in S2 → S3 → S4, S1 → S2 → S4 and S1 → S2 → S3.
In one embodiment, further comprising: and when the sub execution sequence of all the subprograms is matched with the target execution sequence, judging that the program flow is normal.
Illustratively, assuming that subroutines S1, S2, S3, and S4 are present, run by cores CPU1, CPU2, CPU3, and CPU4, respectively, with a target execution order of S1 → S2 → S3 → S4; monitoring S2, S3 and S4 by using a monitoring program M1 on the CPU1, monitoring S1, S3 and S4 by using a monitoring program M2 on the CPU2, monitoring S1, S2 and S4 by using a monitoring program M3 on the CPU3, monitoring S1, S2 and S3 by using a monitoring program M4 on the CPU4, and judging that the program flow is correct when the sub-execution sequence output by the CPU1 is S2 → S3 → S4, the sub-execution sequence output by the CPU2 is S1 → S3 → S4, the sub-execution sequence output by the CPU3 is S1 → S2 → S4 and the sub-execution sequence output by the CPU2 is S1 → S2 → S3, and all the sub-execution sequences are matched with the target execution sequence S1 → S2 → S3 → S4.
Compared with the prior art, the monitoring program is arranged in the cores and used for monitoring other subprograms outside the cores, so that the situation that the subprograms in the cores in which the monitoring program is located cannot be executed due to the fact that the monitoring program falls into a dead loop is avoided, and monitoring coverage is improved.
The specific flow of the multi-core system program flow monitoring method according to the embodiment of the present invention may also refer to fig. 2.
Referring to fig. 3, which is a schematic structural diagram of a multi-core system program flow monitoring device provided in an embodiment of the present invention, the multi-core system program flow monitoring device includes:
the monitor program allocation module 11 is configured to allocate a monitor program in each core in the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
a relationship establishing module 12, configured to establish an association relationship between the monitor in each kernel and the subprograms in the other kernels;
a sub-execution sequence monitoring module 13, configured to, when all of the plurality of sub-programs are executed, obtain a sub-execution sequence of the sub-program monitored by the monitoring program;
and the program flow judging module 14 is used for judging that the program flow of the multi-core system has an exception when the sub-execution sequence of any sub-program does not match with the target execution sequence.
The monitor program allocating module 11, for example, allocates one monitor program to each kernel by responding to the monitoring instruction, so as to monitor the execution sequence of the plurality of subprograms corresponding to the specific function; the monitoring instruction may be automatically generated after the multi-core system is powered on, that is, the monitoring program is allocated immediately when the multi-core system is powered on, or the monitoring instruction may be a specific function starting instruction input by a user, that is, when an instruction for starting a specific function is received, the monitoring program is allocated to each core, which is not limited herein; the specific function may be a music playing function or a video playing function, and is not limited herein; the monitoring program may be pre-stored in the local memory or the cloud server, and when receiving the monitoring instruction, the monitoring program is directly obtained from the local server or downloaded from the cloud server through networking, which is not limited herein.
The relationship establishing module 12, for example, responds to a specific function starting instruction input by a user, calls a plurality of subprograms corresponding to the specific function, and allocates the plurality of subprograms to the kernel; the specific function starting instruction may be input by a keyboard, a mouse, a touch screen, or voice, and is not limited herein.
In the relationship establishing module 12, it is worth to be noted that the monitoring program does not monitor the subprogram on the core where the monitoring program is located, but is used for monitoring all the subprograms on the other cores, so as to avoid the situation that the monitoring program cannot be executed when the subprogram in the core where the monitoring program is located is trapped in a dead loop, and therefore, only the monitoring program in each core needs to establish an association relationship with the subprograms in the other cores.
In the sub-execution sequence monitoring module 13, for example, based on the association relationship between the monitoring program and the sub-program, the monitoring program is used to monitor the execution process of the sub-program, when a certain sub-program is executed, the monitoring program is used to record the sub-program that is running, and after all the sub-programs are executed, the sub-execution sequences of the sub-programs associated with the monitoring program are obtained.
In the program flow determining module 14, as an example, the target sub-execution order of the sub-program associated with the monitoring program may be obtained by a preset target execution order corresponding to the specific function and the sub-program associated with the monitoring program; and comparing the sub-execution sequence of the subprogram monitored by all the monitoring programs with the target sub-execution sequence of the subprogram associated with the monitoring programs, and judging that the program flow of the multi-core system is abnormal as long as one comparison result is not matched.
In this embodiment, a monitor program is allocated to each core of the multi-core system, and an association relationship between the monitor program in each core and the subprograms in the remaining cores is established, so that when all the subprograms are executed, a subprogram execution sequence monitored by the monitor program is obtained; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; and when the sub execution sequence of any subprogram does not match with the target execution sequence, judging that the program flow of the multi-core system has an exception. Therefore, the monitoring program is arranged in the cores and used for monitoring other subprograms outside the cores, so that the situation that the monitoring program cannot be executed when monitoring the subprograms inside the cores where the monitoring program is located in a dead loop is avoided, and the monitoring coverage is improved.
In one embodiment, the apparatus further comprises:
a subprogram ID distribution module, configured to distribute subprogram IDs for the plurality of subprograms according to the target execution order;
and the kernel ID distribution module is used for distributing the kernel ID to the kernel.
It should be noted that, because the monitor program of each core needs to establish an association relationship with the subprograms in the remaining cores, IDs need to be allocated to the cores and the subprograms, so that the subsequent monitor program may determine the corresponding monitor object.
Illustratively, assume that a specific function a includes three subroutines S1, S2, and S3, where S1, S2, and S3 are subroutine IDs assigned to the three subroutines in a preset target execution order, S1 is the first subroutine to be executed, and S3 is the last subroutine to be executed. Assume that there are three cores, numbered CPU1, CPU2, and CPU3, respectively.
It should be noted that ID assignment of the sub-program is not limited to the ascending order numbering according to the target execution order, may be the descending order numbering according to the target execution order, or may be other numbering forms, and is not limited herein.
In an embodiment, the relationship establishing module 12 specifically includes:
a monitor ID allocation unit for allocating a monitor ID to the monitor;
the kernel and monitor program mapping unit is used for establishing an association relationship between the kernel ID and the monitor program ID of the monitor program in the kernel of the kernel;
the kernel and subprogram mapping unit is used for establishing an association relationship between the kernel ID and the subprogram ID of the subprogram in the kernel of the kernel;
and the monitor program and subprogram mapping unit is used for establishing an association relationship between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
It should be noted that, in order to enable the monitor program in each core to monitor the subroutines in the other cores, the monitor program ID is allocated to the monitor program, after each core is allocated with a monitor program, the association between the core and the monitor program is realized by establishing the one-to-one association relationship between the core ID and the monitor program ID,
illustratively, assume that there are three cores, numbered CPU1, CPU2, and CPU3, respectively, and that the specific function a includes three subroutines S1, S2, and S3, where S1 is assigned to CPU1, S2 is assigned to CPU2, and S3 is assigned to CPU3. Each kernel is distributed with a monitoring program, the number of the kernel where the monitoring program is located is referred to, and the monitoring program is numbered, namely the monitoring program in the CPU1 is distributed with an ID M1, the monitoring program in the CPU2 is distributed with an ID M2, and the monitoring program in the CPU3 is distributed with an ID M3; respectively establishing one-to-one corresponding incidence relations of CPU1 and M1, CPU2 and M2, and CPU3 and M3; respectively establishing the association relations of S1 in the CPU1 and the CPU1, S2 in the CPU2 and the CPU3 in the CPU3 and the CPU 2; according to the one-to-one association relationship between the CPU1 and the M1, the CPU2 and the M2, and the CPU3 and the M3, and the association relationship between the CPU1 and the S1, the CPU2 and the S2, and the CPU3 and the S3, the association between the M1 and the S2 and the S3 is established, the association between the M2 and the S1 and the S3 is established, so that the purposes of monitoring the S2 and the S3 by the M1, monitoring the S1 and the S3 by the M2, and monitoring the S1 and the S2 by the M3 are achieved.
It should be noted that the number of kernels, the number of subroutines, and the number of monitoring programs are not limited to the above specific settings; the allocation of the monitor program IDs of the monitor programs is not limited to the allocation rule, and in practical application, it is only necessary to ensure that the monitor program IDs of the monitor programs are different.
In one embodiment, the monitor program and subroutine mapping unit specifically includes:
a detection point ID distribution subunit, configured to set a detection point in each of the subroutines, and distribute a detection point ID to the detection point;
a subprogram and detection point mapping subunit, configured to establish an association relationship between the subprogram ID and the detection point IDs of the detection points in the subprogram itself;
and the monitoring program and detection point mapping subunit is used for establishing an association relationship between the monitoring program ID and the detection point ID corresponding to the subprogram ID according to the association relationship between the monitoring program ID and the subprogram ID.
It should be noted that the detection points required by the monitoring program are placed in the corresponding subprograms, and the detection of the execution sequence of the subprograms is realized by monitoring the detection points.
Illustratively, assuming that there are three monitoring programs M1, M2, and M3, the specific function a includes three subroutines S1, S2, and S3, M1 is associated with S2, S3, M2 is associated with S1, S3, and M3 is associated with S1, S2; at S1, at set detection point CP1, at S2, at set detection point CP2, at S3, at set detection point CP3, and respectively establishing the association relationship between S1 and CP1, S2 and CP2, S3 and CP3, and further establishing the association relationship between M1 and CP2, CP3, M2 and CP1, CP3, M3 and CP1, CP 2.
In an embodiment, the sub-execution sequence monitoring module 13 specifically includes:
a detection point sub-execution sequence monitoring unit, configured to obtain a sub-execution sequence of detection points detected by the monitoring program when all the plurality of sub-programs are executed;
and the subprogram sub-execution sequence generating unit is used for generating the sub-execution sequence of the subprogram according to the sub-execution sequence of the detection points based on the incidence relation between the subprogram ID and the detection point ID.
Specifically, when the subprogram is executed to a detection point arranged on the subprogram, the corresponding monitoring program records the detection point ID of the detection point, when all the subprograms are executed, the subprogram execution sequence of the detection point is obtained, and the subprogram execution sequence of the subprogram is obtained by combining the association relationship between the subprogram ID and the detection point ID.
For example, assume that there are subroutines S1, S2, S3, and S4, detection points CP1, CP2, CP3, and CP4, and monitoring routines M1, M2, M3, and M4; wherein, S1 is associated with CP1, S2 is associated with CP2, S3 is associated with CP3, and S4 is associated with CP 4; m1 is associated with CP2, CP3, CP4, M2 is associated with CP1, CP3, CP4, M3 is associated with CP1, CP2, CP4, M4 is associated with CP1, CP2, CP3. After the actual execution of the subroutine is completed, the sub-execution order of the detection points detected by M1, CP2 → CP3 → CP4, the sub-execution order of the detection points detected by M2, CP1 → CP3 → CP4, the sub-execution order of the detection points detected by M3, CP1 → CP2 → CP4, the sub-execution order of the detection points detected by M4, CP1 → CP2 → CP3 are acquired; the sub-execution order of the detection points is converted into the sub-execution order of the sub-program, resulting in S2 → S3 → S4, S1 → S2 → S4 and S1 → S2 → S3.
In one embodiment, the program flow determining module 14 is further configured to determine that the program flow is normal when the sub-execution orders of all the sub-programs match the target execution order.
For example, assuming that there are subroutines S1, S2, S3, and S4, which are executed by cores CPU1, CPU2, CPU3, and CPU4, respectively, the target execution order is S1 → S2 → S3 → S4; monitoring S2, S3 and S4 by using a monitoring program M1 on the CPU1, monitoring S1, S3 and S4 by using a monitoring program M2 on the CPU2, monitoring S1, S2 and S4 by using a monitoring program M3 on the CPU3, monitoring S1, S2 and S3 by using a monitoring program M4 on the CPU4, and judging that the program flow is correct when the sub-execution sequence output by the CPU1 is S2 → S3 → S4, the sub-execution sequence output by the CPU2 is S1 → S3 → S4, the sub-execution sequence output by the CPU3 is S1 → S2 → S4 and the sub-execution sequence output by the CPU2 is S1 → S2 → S3, and all the sub-execution sequences are matched with the target execution sequence S1 → S2 → S3 → S4.
It should be noted that, in the specific working process of the multicore system program flow monitoring apparatus, reference may be made to the working process of the multicore system program flow monitoring method in the foregoing embodiment.
Compared with the prior art, the monitoring program is arranged in the cores and used for monitoring other subprograms outside the cores, so that the situation that the subprograms in the cores in which the monitoring program is located cannot be executed due to the fact that the monitoring program falls into a dead loop is avoided, and monitoring coverage is improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a multicore system program flow monitoring device according to an embodiment of the present invention, where the multicore system program flow monitoring device includes a processor 21, a memory 22, and a computer program stored in the memory 22 and configured to be executed by the processor 21, and when the processor 21 executes the computer program, the steps in the multicore system program flow monitoring method embodiment, for example, steps S1 to S4 shown in fig. 1, are implemented. Alternatively, the processor 21 may implement the functions of the modules in the above device embodiments when executing the computer program, for example, the monitor program distribution module 11.
Illustratively, the computer program may be divided into one or more modules, which are stored in the memory 22 and executed by the processor 21 to accomplish the present invention. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used for describing the execution process of the computer program in the multi-core-oriented program flow monitoring device. For example, the computer program may be divided into a monitor distribution module 11, a relationship establishment module 12, a sub-execution sequence monitoring module 13, and a program flow determination module 14, and the specific functions of each module are as follows:
the monitor program allocation module 11 is configured to allocate a monitor program in each core in the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
a relationship establishing module 12, configured to establish an association relationship between the monitor in each kernel and the subprograms in the other kernels;
a sub-execution sequence monitoring module 13, configured to, when all the sub-programs have been executed, obtain a sub-execution sequence of the sub-program monitored by the monitoring program;
and the program flow judging module 14 is used for judging that the program flow of the multi-core system has an exception when the sub-execution sequence of any sub-program does not match with the target execution sequence.
For the specific working process of each module, reference may be made to the working process of the multi-core system program flow monitoring device described in the foregoing embodiment, which is not described herein again.
The multi-core system program flow monitoring device can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing devices. The multi-core system program flow monitoring device may include, but is not limited to, a processor 21 and a memory 22. It will be understood by those skilled in the art that the schematic diagram is merely an example of the multi-core system program flow monitoring device, and does not constitute a limitation of the multi-core system program flow monitoring device, and may include more or less components than those shown, or combine some components, or different components, for example, the multi-core system program flow monitoring device may further include an input-output device, a network access device, a bus, etc.
The Processor 21 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, and the processor 21 is a control center of the multicore system program flow monitoring device, and various interfaces and lines are used to connect various parts of the whole multicore system program flow monitoring device.
The memory 22 may be used to store the computer programs and/or modules, and the processor 21 implements various functions of the multicore system program flow monitoring apparatus by executing or executing the computer programs and/or modules stored in the memory 22 and calling data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory 22 may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The module integrated by the multi-core system program flow monitoring device can be stored in a computer readable storage medium if the module is implemented in the form of a software functional unit and sold or used as an independent product. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (10)

1. A multi-core system program flow monitoring method is characterized by comprising the following steps:
allocating a monitor program in each kernel in the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
establishing an association relationship between the monitor program in each kernel and the subprograms in the rest kernels;
when the plurality of subprograms are executed completely, acquiring a subprogram execution sequence monitored by the monitoring program;
and when the sub execution sequence of any subprogram does not match with the target execution sequence, judging that the program flow of the multi-core system has an exception.
2. The method for monitoring program flow in a multi-core system according to claim 1, wherein before each of the cores in the multi-core system is allocated with a monitor, the method further comprises:
distributing subprogram IDs to the plurality of subprograms according to the target execution sequence;
a kernel ID is assigned to the kernel.
3. The method for monitoring program flow of a multi-core system according to claim 2, wherein the establishing of the association relationship between the monitor program in each core and the subprograms in the remaining cores specifically comprises:
allocating a monitor ID to the monitor;
establishing an association relation between the kernel ID and a monitor ID of a monitor in the kernel of the kernel;
establishing an association relation between the kernel ID and the subprogram ID of the subprogram in the kernel of the kernel;
and establishing an association relationship between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
4. The method for monitoring program flow in a multi-core system according to claim 3, wherein the establishing of the association relationship between the monitor ID corresponding to each core ID and the subprogram IDs corresponding to the other core IDs specifically includes:
setting a detection point in each subprogram, and distributing a detection point ID for the detection point;
establishing an association relation between the subprogram ID and the detection point ID of the detection point in the subprogram;
and establishing an association relationship between the monitoring program ID and a detection point ID corresponding to the subprogram ID according to the association relationship between the monitoring program ID and the subprogram ID.
5. The method according to claim 4, wherein the obtaining of the sub-execution sequence of the sub-programs monitored by the monitoring program specifically includes:
acquiring a sub-execution sequence of the detection points detected by the monitoring program;
and generating the sub-execution sequence of the subprogram according to the sub-execution sequence of the detection points based on the incidence relation between the subprogram ID and the detection point ID.
6. The multi-core system program flow monitoring method of any of claims 1 to 5, further comprising: and when the sub execution sequence of all the subprograms is matched with the target execution sequence, judging that the program flow is normal.
7. A multi-core system program flow monitoring apparatus, comprising:
the monitoring program distribution module is used for distributing a monitoring program in each kernel in the multi-core system; the monitoring program is used for monitoring a plurality of subprograms corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
the relation establishing module is used for establishing an association relation between the monitoring program in each kernel and the subprograms in the rest kernels;
a sub-execution sequence monitoring module, configured to obtain a sub-execution sequence of the sub-program monitored by the monitoring program when the plurality of sub-programs are all executed;
and the program flow judging module is used for judging that the program flow of the multi-core system has an exception when the sub-execution sequence of any subprogram is not matched with the target execution sequence.
8. The multi-core system program flow monitoring apparatus of claim 7, wherein the program flow determination module is further configured to determine that program flow is normal when the sub-execution orders of all the sub-programs match the target execution order.
9. A multi-core system program flow monitoring apparatus comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the multi-core system program flow monitoring method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, comprising a stored computer program, wherein the computer program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform the method for multi-core system program flow monitoring according to any one of claims 1 to 6.
CN202111502127.XA 2021-12-09 Multi-core system program flow monitoring method, device, equipment and storage medium Active CN115220990B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111502127.XA CN115220990B (en) 2021-12-09 Multi-core system program flow monitoring method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111502127.XA CN115220990B (en) 2021-12-09 Multi-core system program flow monitoring method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115220990A true CN115220990A (en) 2022-10-21
CN115220990B CN115220990B (en) 2024-04-19

Family

ID=

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013054625A (en) * 2011-09-06 2013-03-21 Toyota Motor Corp Information processor and information processing method
WO2014202825A1 (en) * 2013-06-20 2014-12-24 Nokia Corporation Microprocessor apparatus
JP2017073083A (en) * 2015-10-09 2017-04-13 株式会社デンソー Parallelization method, parallelization tool, and on-vehicle device
CN108646708A (en) * 2018-05-02 2018-10-12 阳光电源股份有限公司 A kind of program flow monitoring method and system
DE102019202228A1 (en) * 2018-02-21 2019-08-22 Denso Corporation Parallelization method, parallelization tool, multi-core microcomputer and in-vehicle device
JP2019145065A (en) * 2018-02-21 2019-08-29 株式会社デンソー Parallelizing method, parallelizing tool, multi-core microcomputer and on-vehicle unit
CN112799729A (en) * 2021-01-29 2021-05-14 苏州浪潮智能科技有限公司 Uboot starting method, device, equipment and storage medium of multi-core system on chip
CN113722143A (en) * 2021-09-24 2021-11-30 中国第一汽车股份有限公司 Program flow monitoring method and device, electronic equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013054625A (en) * 2011-09-06 2013-03-21 Toyota Motor Corp Information processor and information processing method
WO2014202825A1 (en) * 2013-06-20 2014-12-24 Nokia Corporation Microprocessor apparatus
JP2017073083A (en) * 2015-10-09 2017-04-13 株式会社デンソー Parallelization method, parallelization tool, and on-vehicle device
DE102019202228A1 (en) * 2018-02-21 2019-08-22 Denso Corporation Parallelization method, parallelization tool, multi-core microcomputer and in-vehicle device
JP2019145065A (en) * 2018-02-21 2019-08-29 株式会社デンソー Parallelizing method, parallelizing tool, multi-core microcomputer and on-vehicle unit
CN108646708A (en) * 2018-05-02 2018-10-12 阳光电源股份有限公司 A kind of program flow monitoring method and system
CN112799729A (en) * 2021-01-29 2021-05-14 苏州浪潮智能科技有限公司 Uboot starting method, device, equipment and storage medium of multi-core system on chip
CN113722143A (en) * 2021-09-24 2021-11-30 中国第一汽车股份有限公司 Program flow monitoring method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
JP6912583B2 (en) Service processing method and equipment
CN108462760B (en) Electronic device, automatic cluster access domain name generation method and storage medium
CN107896162B (en) Deployment method and device of monitoring system, computer equipment and storage medium
CN110765026A (en) Automatic testing method and device, storage medium and equipment
CN112416353A (en) Channel package packaging method and device and computer equipment
WO2020119029A1 (en) Distributed task scheduling method and system, and storage medium
WO2021121407A1 (en) Capacity changing method and apparatus for virtual machine
CN110389903B (en) Test environment deployment method and device, electronic equipment and readable storage medium
US20160026511A1 (en) Method, apparatus and system for acquiring input events
CN111200744B (en) Multimedia playing control method and device and intelligent equipment
CN112559190B (en) Resource allocation method, system, device, equipment and medium among heterogeneous systems
US20210191701A1 (en) Method and system for profile based deployments
US10520929B2 (en) Techniques for implementing universal commands in a welding or cutting system
US9734103B2 (en) Systems and methods for transforming a central processing unit (CPU) socket into a memory and/or input/output (I/O) expander
CN115220990A (en) Multi-core system program flow monitoring method, device, equipment and storage medium
CN115220990B (en) Multi-core system program flow monitoring method, device, equipment and storage medium
CN105824622B (en) Data processing method and electronic equipment
CN109739779B (en) Method for acquiring available storage space in java card, computer device and computer readable storage medium
CN115454576B (en) Virtual machine process management method and system and electronic equipment
CN108647090B (en) Resource allocation method and device and server cluster
US9959187B2 (en) Decoalescing resource utilization at boot
US9348667B2 (en) Apparatus for managing application program and method therefor
CN114860321A (en) External device control method, device, equipment and medium based on raspberry pi
CN114371954A (en) Automatic recovery method of micro-service system
TW202303385A (en) Processing method and device of firmware updating

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant