Hotspot detection method and system based on domestic Shenwei platform
By defining the directory tree structure on the domestic Shenwei platform, traversing and retrieving functions in C files, and instrumenting them, the problem of difficult to realize hot spot detection at function-level diversity in the existing technology is solved, and the function of hot spot detection is realized.
Patent Information
- Application Number
- CN202510279977.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-03-11
AI Technical Summary
It is difficult for the existing technology to realize hot spot detection of function-level diversity, especially on the domestic Shenwei platform.
By defining the file structure of the project into a directory tree structure, initializing and building the root node, traversing the directory structure, searching the function name in the C file, and instrumenting the source code according to the selected instrumentation function, and recording the execution time of the instrumentation function to achieve hot spot detection.
The top-down traversal strategy is implemented, and the C file functions in the project directory structure are retrieved, and the functions to be inserted manually are selected to perform hot spot detection, achieving the purpose of function-level diversity hot spot detection.
Smart Images

Figure CN119782130B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a hotspot detection method and system based on a domestic Shenwei platform. Background Art
[0002] At present, the domestic Shenwei platform provides a hot function analysis tool swprof based on executable files, and the user program does not need to be recompiled with options. The working mode of swprof is specified by the job management parameters, and supports all, masterslave and three parameters. Among them, all analyzes all master and slave codes to obtain master and slave hot functions; master only analyzes the main core code to obtain the main core hot functions; slave only analyzes the slave core code to obtain the slave core hot functions. However, this method is only for hot spot detection at runtime. When facing the function-level diversity hot spot detection, this method is obviously insufficient.
[0003] How to achieve function-level diversity hotspot detection is a technical problem that needs to be solved. Summary of the invention
[0004] The technical task of the present invention is to address the above shortcomings and provide a hotspot detection method and system based on the domestic Shenwei platform to solve the technical problem of how to achieve function-level diversity hotspot detection.
[0005] In a first aspect, the present invention provides a hotspot detection method based on a domestic Shenwei platform, comprising the following steps:
[0006] Node and directory tree structure definition: define the file structure of the project as a directory tree structure, and define a directory content at each level of the project as a node;
[0007] Root node initialization and directory tree construction: For the root directory of the project, initialize and build the root node, add the root node to the built queue structure, traverse all subdirectories and files under the root directory through queue management, build the directory tree structure of the root node, and record the directory tree results of the root node in the log file when exiting the queue;
[0008] Directory content retrieval and node construction: perform a dequeue operation on each node in the queue structure, retrieve the directory content corresponding to the node, build a new node for a non-empty directory, and add the new node to the queue structure. For C files, perform function name retrieval and record the function name retrieval results in the log file;
[0009] Instrumentation execution: Select the function to be instrumented as the instrumentation function according to the log file, instrument the source code according to the selected instrumentation function, record the execution time of the instrumentation function and record the execution time of the instrumentation function in the time-consuming result file. The time-consuming result file includes the function execution time of all processes, wherein the source code is instrumented through macro definition;
[0010] Result analysis: Extract the instrumented functions and their corresponding execution time from the time-consuming result file, and analyze the time-consuming issues between process communications manually.
[0011] Preferably, a node is composed of a four-tuple, which are the absolute path of the directory content, the set of child nodes of the directory content, the parent node of the directory content, and the set of function names of the directory content;
[0012] Correspondingly, for the root directory of the project, the root node is initialized and constructed based on the absolute path of the root directory.
[0013] Preferably, directory content retrieval and node construction include the following steps:
[0014] L100, determine whether the queue structure is empty, if the queue structure is not empty, execute step L200;
[0015] L200, the first element of the queue structure is dequeued, and the directory content of the first element is retrieved. If the directory content of the first element is not empty, step L300 is executed. If the directory content of the first element is empty, the directory content retrieval and node construction operation are terminated;
[0016] L300. If the type of the directory content is a directory, construct a new node from the directory content and add the new node to the queue structure. Through queue management, traverse all subdirectories and files under the current directory, construct a directory tree structure of the new node, and record the directory tree structure of the new node in the log file.
[0017] If the type of the directory content is a file, a function name search is performed on the functions in the file, and the function name search result of the file is recorded in a log file.
[0018] Preferably, when searching for function names, regular expressions are used to search for function names within the file.
[0019] In a second aspect, the present invention provides a hotspot detection system based on a domestic Shenwei platform, which is used to perform hotspot detection by using a hotspot detection method based on a domestic Shenwei platform as described in any one of the first aspects, wherein the system includes a node and directory tree structure definition module, a root node initialization and directory tree construction module, a directory content retrieval and node construction module, a stub execution module, and a result analysis module;
[0020] The node and directory tree structure definition module is used to perform the following: define the file structure of the project as a directory tree structure, and define a directory content at each level of the project as a node;
[0021] The root node initialization and directory tree construction module is used to perform the following: for the root directory of the project, initialize and build the root node, add the root node to the built queue structure, traverse all subdirectories and files under the root directory through queue management, build the directory tree structure of the root node, and record the directory tree result of the root node in the log file when exiting the queue;
[0022] The directory content retrieval and node construction module is used to perform the following: dequeue each node in the queue structure, retrieve the directory content corresponding to the node, build a new node for a non-empty directory, and add the new node to the queue structure; for C files, perform function name retrieval, and record the function name retrieval results in the log file;
[0023] The instrumentation execution module is used to perform the following: select a function to be instrumented as an instrumentation function according to a log file, instrument the source code according to the selected instrumentation function, record the execution time of the instrumentation function and record the execution time of the instrumentation function in a time-consuming result file, wherein the time-consuming result file includes the function execution time of all processes, wherein the source code is instrumented through macro definition;
[0024] The result analysis module is used to perform the following: extract the instrumented functions and the corresponding execution time from the time-consuming result file, and analyze the time-consuming problem between process communications manually.
[0025] Preferably, a node is composed of a four-tuple, which are the absolute path of the directory content, the set of child nodes of the directory content, the parent node of the directory content, and the set of function names of the directory content;
[0026] Correspondingly, for the root directory of the project, the root node is initialized and constructed based on the absolute path of the root directory.
[0027] Preferably, directory content retrieval and node construction are used to perform the following operations:
[0028] L100, determine whether the queue structure is empty, if the queue structure is not empty, execute step L200;
[0029] L200, the first element of the queue structure is dequeued, and the directory content of the first element is retrieved. If the directory content of the first element is not empty, step L300 is executed. If the directory content of the first element is empty, the directory content retrieval and node construction operation are terminated;
[0030] L300. If the type of the directory content is a directory, construct a new node from the directory content and add the new node to the queue structure. Through queue management, traverse all subdirectories and files under the current directory, construct a directory tree structure of the new node, and record the directory tree structure of the new node in the log file.
[0031] If the type of the directory content is a file, a function name search is performed on the functions in the file, and the function name search result of the file is recorded in a log file.
[0032] Preferably, when performing function name retrieval, the directory content retrieval and node construction module is used to search for the function name in the file through a regular expression.
[0033] The hotspot detection method and system based on the domestic Shenwei platform of the present invention have the following advantages: starting from the project source code directory, a top-down traversal strategy is adopted to traverse the directory structure of the entire project, retrieve the functions in its C file, and manually select the functions to be plugged based on the traversal results, so as to perform hotspot detection and realize function-level diversity hotspot detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] The present invention is further described below in conjunction with the accompanying drawings.
[0036] Figure 1 This is a flowchart of a hotspot detection method based on the domestic Shenwei platform in Example 1. DETAILED DESCRIPTION
[0037] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.
[0038] The embodiments of the present invention provide a hotspot detection method and system based on the domestic Shenwei platform, which are used to solve the technical problem of how to achieve function-level diversity hotspot detection.
[0039] Embodiment 1:
[0040] The present invention discloses a hotspot detection method based on the domestic Shenwei platform, which includes five steps: node and directory tree structure definition, root node initialization and directory tree construction, directory content retrieval and node construction, stub execution and result analysis.
[0041] Step S100: Node and directory tree structure definition: define the file structure of the project as a directory tree structure, and define a directory content at each level of the project as a node.
[0042] In this embodiment, a directory content of each layer of the project is defined as a node. A node N is composed of a four-tuple (D, C, P, F), where D represents the absolute path of the directory content, C represents the set of child nodes of the directory content, P represents the parent node of the directory content, and F represents the set of function names of the directory content. Q is defined as a queue structure. The structure of the node is designed as follows:
[0043] struct Node{
[0044] char *dirpath;
[0045] Node* children; / / has both father and child, it is a double linked list
[0046] Node *parent;
[0047] char**func; / / function
[0048] }Node;
[0049] / / Define the queue structure
[0050] typedef struct Queue {
[0051] Node* front; / / Team head pointer
[0052] Node* rear; / / tail pointer
[0053] } Queue;
[0054] Step S200 root node initialization and directory tree construction: for the root directory of the project, initialize and construct the root node, add the root node to the constructed queue structure, traverse all subdirectories and files under the root directory through queue management, build the directory tree structure of the root node, and record the directory tree results of the root node in the log file when leaving the queue.
[0055] In this embodiment, given the absolute path of the project root directory, the root node N0 is constructed and initialized, and the directory tree structure of the root node is printed to the log file. The root node is initialized as follows:
[0056] struct Node* N0= (struct Node*)malloc(sizeof(struct Node));
[0057] N0->dirpath=””; / / Enter the absolute path
[0058] N0->children=NULL;
[0059] N0->parent=NULL;
[0060] The root node is queued as follows:
[0061] queue->front = queue->rear = N0; / / queue is the newly constructed queue.
[0062] Initialize the queue through the above operations.
[0063] Step S300 Directory content retrieval and node construction: dequeue each node in the queue structure, retrieve the directory content corresponding to the node, build a new node for a non-empty directory, and add the new node to the queue structure. For C files, perform function name retrieval and record the function name retrieval results in the log file.
[0064] As a specific implementation of directory content retrieval and node construction, the following steps are included:
[0065] L100, determine whether the queue structure is empty. If the queue structure is not empty, execute step L200. The execution code corresponding to this step is as follows:
[0066] if (isEmpty(queue)) {
[0067] printf("Queue is empty\n");
[0068] return NULL;
[0069] };
[0070] L200, the first element of the queue structure is dequeued, and the directory content of the first element is retrieved. If the directory content of the first element is not empty, step L300 is executed. If the directory content of the first element is empty, the directory content retrieval and node construction operation are terminated. The execution code corresponding to this step is as follows:
[0071] Node* temp = queue->front; / / Save the head node
[0072] If (temp->dirpath==NULL) {
[0073] queue->front = queue->front->next; / / Move the queue head pointer to the next node
[0074] if (queue->front == NULL) {
[0075] queue->rear = NULL;
[0076] }
[0077] free(temp); / / Release the memory of the original team head node
[0078] };
[0079] L300. If the type of the directory content is a directory, construct a new node from the directory content and add the new node to the queue structure. Through queue management, traverse all subdirectories and files under the current directory, build a directory tree structure for the new node, and record the directory tree structure for the new node in the log file. If the type of the directory content is a file, perform a function name search on the functions in the file, and record the function name search results of the file in the log file. See the pseudo code for the key value description.
[0080] In this embodiment, the function name in the file is searched by regular expression.
[0081] Here is how:
[0082] Node* temp = queue->front; / / temp represents the first element of the queue
[0083] if(temp->dirpath!=NULL){
[0084] / / Determine the directory
[0085] DIR* dir = opendir(temp->dirpath); / / Directory function file dirent.h operation
[0086] / / Read directory contents
[0087] struct dirent* entry;
[0088] while ((entry = readdir(dir)) != NULL) {
[0089] temp->dirpath+=entry->d_name;
[0090] struct stat statbuf;
[0091] stat(temp->dirpath,&statbuf);
[0092] If(S_ISDIR(statbuf.st_mode)==1){
[0093] chdir(temp->dirpath);
[0094] getcwd(cwd, sizeof(cwd)); / / Get the current working directory again
[0095] / / It is a directory, construct a new node
[0096] temp1->dirpath=cwd;
[0097] temp1->parent=temp;
[0098] temp.children=temp1;
[0099] The temp1 node enters the queue;
[0100] / / The head node of the team is recorded in the log file;
[0101] cJSON_AddStringToObject(root, "dirname", temp1->dirpath); cJSON_AddStringToObject(root, "parent", temp->dirpath); char* json_string = cJSON_Print(root);FILE* file = fopen(filename, "w"); / / Set the file name yourselffprintf(file,"%s", json_string); / / Write to log file
[0102] The head node exits the queue;
[0103] goto 1;
[0104] }else(strcmp(temp->dirpath+ strlen(temp->dirpath) - 2, ".c") == 0){ / / Judge c file FILE* file = fopen(temp->dirpath, "r");const char* pattern = "[a-zA-Z_][a-zA-Z0-9_]*\\s*\\([^)]*\\)\\s*\\{";regex_t regex;regcomp(®ex,pattern, REG_EXTENDED) ;char line
[256] ;while (fgets(line, sizeof(line),file)) { / / Extract function name if (regexec(®ex, line, 0, NULL, 0) == 0) {strchr(line, '('); Temp.func=line;cJSON_AddStringToObject(root, "func", temp->dirpath+"+"+line); char* json_string = cJSON_Print(root); FILE* file = fopen(filename, "w"); / / Set the file name yourself fprintf(file, "%s", json_string); / / Write to log file};}}
[0105] } / / End reading directory contents.
[0106] Step S400: Execution of instrumentation: Select the function to be instrumented as the instrumentation function according to the log file, instrument the source code according to the selected instrumentation function, record the execution time of the instrumentation function and record the execution time of the instrumentation function in the time-consuming result file, which includes the function execution time of all processes.
[0107] When the source code is instrumented according to the selected instrumentation function, the key value of the instrumentation function in the log file is added as 1, the log file is read through the code, the instrumentation function is instrumented according to the "1" value, function name, and file directory, the instrumentation is performed through macro definitions, and then the program is compiled and run, and the program running results are output to the time-consuming result file.
[0108] In this embodiment, the function to be plugged is selected according to the log file, and the project is retrieved according to the selected result file. The plugging is performed in the compilation stage. The default plugging function is: MPI_Wtime(), and the format is "function name = time consumed". Multiple processes print multiple results of a function at the same time, and all are output to the time-consuming result file.
[0109] Manually add macro definitions to automatically insert time calculation code before and after function calls, and link the macro definition header file during compilation.
[0110] #define TIME_IT(func) \do { \double start = MPI_Wtime(); \func; \double end = MPI_Wtime(); \double cpu_time_used = end - start; \printf("Timetaken by " #func ": %f seconds\n", cpu_time_used); \} while (0)Decide whether to use the instrumentation function based on the read json log file. if (strcmp(input, "1") == 0) { TIME_IT(func);}else{ func;} 。
[0111] Step S500: Result analysis: extract the stub function and the corresponding execution time from the time-consuming result file, and analyze the time-consuming problem between process communications manually.
[0112] The method of this embodiment starts from the project source code directory, adopts a top-down traversal strategy, traverses the directory structure of the entire project, retrieves the functions in its c files, and manually selects the functions to be plugged based on the traversal results, thereby performing hotspot detection.
[0113] Embodiment 2:
[0114] The present invention discloses a hotspot detection system based on the domestic Shenwei platform, comprising a node and directory tree structure definition module, a root node initialization and directory tree construction module, a directory content retrieval and node construction module, a pile execution module and a result analysis module.
[0115] The node and directory tree structure definition module is used to perform the following: define the file structure of the project as a directory tree structure, and define a directory content at each level of the project as a node.
[0116] In this embodiment, a directory content of each layer of the project is defined as a node. A node N is composed of a four-tuple (D, C, P, F), where D represents the absolute path of the directory content, C represents the set of child nodes of the directory content, P represents the parent node of the directory content, and F represents the set of function names of the directory content. Q is defined as a queue structure. The structure of the node is designed as follows:
[0117] struct Node{
[0118] char *dirpath;
[0119] Node* children; / / has both father and child, it is a double linked list
[0120] Node *parent;
[0121] char**func; / / function
[0122] }Node;
[0123] / / Define the queue structure
[0124] typedef struct Queue {
[0125] Node* front; / / Team head pointer
[0126] Node* rear; / / tail pointer
[0127] } Queue;
[0128] The root node initialization and directory tree construction module is used to perform the following: for the root directory of the project, initialize and build the root node, add the root node to the built queue structure, traverse all subdirectories and files under the root directory through queue management, build the directory tree structure of the root node, and record the directory tree results of the root node in the log file when leaving the queue.
[0129] In this embodiment, given the absolute path of the project root directory, the root node N0 is constructed and initialized, and the directory tree structure of the root node is printed to the log file. The root node is initialized as follows:
[0130] struct Node* N0= (struct Node*)malloc(sizeof(struct Node));
[0131] N0->dirpath=””; / / Enter the absolute path
[0132] N0->children=NULL;
[0133] N0->parent=NULL;
[0134] The root node is queued as follows:
[0135] queue->front = queue->rear = N0; / / queue is the newly constructed queue.
[0136] Initialize the queue through the above operations.
[0137] The directory content retrieval and node construction module is used to perform the following: dequeue each node in the queue structure, retrieve the directory content corresponding to the node, build a new node for a non-empty directory, and add the new node to the queue structure; for C files, perform function name retrieval, and record the function name retrieval results in the log file.
[0138] As a specific implementation of the directory content retrieval and node construction module, this module is used to perform the following operations:
[0139] L100, determine whether the queue structure is empty. If the queue structure is not empty, execute step L200. The execution code corresponding to this step is as follows:
[0140] if (isEmpty(queue)) {
[0141] printf("Queue is empty\n");
[0142] return NULL;
[0143] };
[0144] L200, the first element of the queue structure is dequeued, and the directory content of the first element is retrieved. If the directory content of the first element is not empty, step L300 is executed. If the directory content of the first element is empty, the directory content retrieval and node construction operation are terminated. The execution code corresponding to this step is as follows:
[0145] Node* temp = queue->front; / / Save the head node
[0146] If (temp->dirpath==NULL) {
[0147] queue->front = queue->front->next; / / Move the queue head pointer to the next node
[0148] if (queue->front == NULL) {
[0149] queue->rear = NULL;
[0150] }
[0151] free(temp); / / Release the memory of the original team head node
[0152] };
[0153] L300. If the type of the directory content is a directory, construct a new node from the directory content and add the new node to the queue structure. Through queue management, traverse all subdirectories and files under the current directory, build a directory tree structure for the new node, and record the directory tree structure for the new node in the log file. If the type of the directory content is a file, perform a function name search on the functions in the file, and record the function name search results of the file in the log file. See the pseudo code for the key value description.
[0154] In this embodiment, the function name in the file is searched by regular expression.
[0155] Here is how:
[0156] Node* temp = queue->front; / / temp represents the first element of the queue
[0157] if(temp->dirpath!=NULL){
[0158] / / Determine the directory
[0159] DIR* dir = opendir(temp->dirpath); / / Directory function file dirent.h operation
[0160] / / Read directory contents
[0161] struct dirent* entry;
[0162] while ((entry = readdir(dir)) != NULL) {
[0163] temp->dirpath+=entry->d_name;
[0164] struct stat statbuf;
[0165] stat(temp->dirpath,&statbuf);
[0166] If(S_ISDIR(statbuf.st_mode)==1){
[0167] chdir(temp->dirpath);
[0168] getcwd(cwd, sizeof(cwd)); / / Get the current working directory again
[0169] / / It is a directory, construct a new node
[0170] temp1->dirpath=cwd;
[0171] temp1->parent=temp;
[0172] temp.children=temp1;
[0173] The temp1 node enters the queue;
[0174] / / The head node of the team is recorded in the log file;
[0175] cJSON_AddStringToObject(root, "dirname", temp1->dirpath); cJSON_AddStringToObject(root, "parent", temp->dirpath); char* json_string = cJSON_Print(root);FILE* file = fopen(filename, "w"); / / Set the file name yourselffprintf(file,"%s", json_string); / / Write to log file
[0176] The head node exits the queue;
[0177] goto 1;
[0178] }else(strcmp(temp->dirpath+ strlen(temp->dirpath) - 2, ".c") == 0){ / / Judge c file FILE* file = fopen(temp->dirpath, "r");const char* pattern = "[a-zA-Z_][a-zA-Z0-9_]*\\s*\\([^)]*\\)\\s*\\{";regex_t regex;regcomp(®ex,pattern, REG_EXTENDED) ;char line
[256] ;while (fgets(line, sizeof(line),file)) { / / Extract function name if (regexec(®ex, line, 0, NULL, 0) == 0) {strchr(line, '('); Temp.func=line;cJSON_AddStringToObject(root, "func", temp->dirpath+"+"+line); char* json_string = cJSON_Print(root); FILE* file = fopen(filename, "w"); / / Set the file name yourself fprintf(file, "%s", json_string); / / Write to log file};}}
[0179] } / / End reading directory contents.
[0180] The instrumentation execution module is used to perform the following: select the function to be instrumented as the instrumentation function according to the log file, instrument the source code according to the selected instrumentation function, record the execution time of the instrumentation function and record the execution time of the instrumentation function in the time-consuming result file, which includes the function execution time of all processes.
[0181] When the source code is instrumented according to the selected instrumentation function, the key value of the instrumentation function in the log file is added as 1, the log file is read through the code, the instrumentation function is instrumented according to the "1" value, function name, and file directory, the instrumentation is performed through macro definitions, and then the program is compiled and run, and the program running results are output to the time-consuming result file.
[0182] In this embodiment, the function to be plugged is selected according to the log file, and the project is retrieved according to the selected result file. The plugging is performed in the compilation stage. The default plugging function is: MPI_Wtime(), and the format is "function name = time consumed". Multiple processes print multiple results of a function at the same time, all of which are output to the time-consuming result file, and the plugging part is removed according to the selected result file.
[0183] Manually add macro definitions to automatically insert time calculation code before and after function calls, and link the macro definition header file during compilation.
[0184] #define TIME_IT(func) \do { \double start = MPI_Wtime(); \func; \double end = MPI_Wtime(); \double cpu_time_used = end - start; \printf("Timetaken by " #func ": %f seconds\n", cpu_time_used); \} while (0)Decide whether to use the instrumentation function based on the read json log file. if (strcmp(input, "1") == 0) { TIME_IT(func);}else{ func;
[0185] }.
[0186] The result analysis module is used to perform the following: extract the instrumented functions and the corresponding execution time from the time-consuming result file, and analyze the time-consuming problem between process communications manually.
[0187] The system of this embodiment can execute the method disclosed in Example 1 to realize hotspot detection.
[0188] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the means in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.
Claims
1. A hotspot detection method based on the domestic Shenwei platform, characterized in that: The steps include: Node and directory tree structure definition: define the file structure of the project as a directory tree structure, and define a directory content at each level of the project as a node; Root node initialization and directory tree construction: For the root directory of the project, initialize and build the root node, add the root node to the built queue structure, traverse all subdirectories and files under the root directory through queue management, build the directory tree structure of the root node, and record the directory tree results of the root node in the log file when exiting the queue; Directory content retrieval and node construction: perform a dequeue operation on each node in the queue structure, retrieve the directory content corresponding to the node, build a new node for a non-empty directory, and add the new node to the queue structure. For C files, perform function name retrieval and record the function name retrieval results in the log file; Instrumentation execution: Select the function to be instrumented as the instrumentation function according to the log file, instrument the source code according to the selected instrumentation function, record the execution time of the instrumentation function and record the execution time of the instrumentation function in the time-consuming result file. The time-consuming result file includes the function execution time of all processes, wherein the source code is instrumented through macro definition; Result analysis: Extract the instrumented functions and their corresponding execution time from the time-consuming result file, and analyze the time-consuming issues between process communications manually.
2. The hotspot detection method based on the domestic Shenwei platform according to claim 1 is characterized in that: A node consists of four tuples, namely the absolute path of the directory content, the set of child nodes of the directory content, the parent node of the directory content, and the set of function names of the directory content; Correspondingly, for the root directory of the project, the root node is initialized and constructed based on the absolute path of the root directory.
3. The hotspot detection method based on the domestic Shenwei platform according to claim 1 is characterized in that: Directory content retrieval and node construction include the following steps: L100, determine whether the queue structure is empty, if the queue structure is not empty, execute step L200; L200, the first element of the queue structure is dequeued, and the directory content of the first element is retrieved. If the directory content of the first element is not empty, step L300 is executed. If the directory content of the first element is empty, the directory content retrieval and node construction operation are terminated; L300. If the type of the directory content is a directory, construct a new node from the directory content and add the new node to the queue structure. Through queue management, traverse all subdirectories and files under the current directory, construct a directory tree structure of the new node, and record the directory tree structure of the new node in the log file. If the type of the directory content is a file, a function name search is performed on the functions in the file, and the function name search result of the file is recorded in a log file.
4. The hotspot detection method based on the domestic Shenwei platform according to claim 1 is characterized in that: When searching for a function name, search for the function name in the file using a regular expression.
5. A hotspot detection system based on the domestic Shenwei platform, characterized in that: Used to perform hotspot detection by a hotspot detection method based on a domestic Shenwei platform as described in any one of claims 1 to 4, the system includes a node and directory tree structure definition module, a root node initialization and directory tree construction module, a directory content retrieval and node construction module, a stub execution module and a result analysis module; The node and directory tree structure definition module is used to perform the following: define the file structure of the project as a directory tree structure, and define a directory content at each level of the project as a node; The root node initialization and directory tree construction module is used to perform the following: for the root directory of the project, initialize and build the root node, add the root node to the built queue structure, traverse all subdirectories and files under the root directory through queue management, build the directory tree structure of the root node, and record the directory tree result of the root node in the log file when exiting the queue; The directory content retrieval and node construction module is used to perform the following: dequeue each node in the queue structure, retrieve the directory content corresponding to the node, build a new node for a non-empty directory, and add the new node to the queue structure; for C files, perform function name retrieval, and record the function name retrieval results in the log file; The instrumentation execution module is used to perform the following: select a function to be instrumented as an instrumentation function according to a log file, instrument the source code according to the selected instrumentation function, record the execution time of the instrumentation function and record the execution time of the instrumentation function in a time-consuming result file, wherein the time-consuming result file includes the function execution time of all processes, wherein the source code is instrumented through macro definition; The result analysis module is used to perform the following: extract the instrumented functions and the corresponding execution time from the time-consuming result file, and analyze the time-consuming problem between process communications manually.
6. The hotspot detection system based on the domestic Shenwei platform according to claim 5 is characterized in that: A node consists of four tuples, namely the absolute path of the directory content, the set of child nodes of the directory content, the parent node of the directory content, and the set of function names of the directory content; Correspondingly, for the root directory of the project, the root node is initialized and constructed based on the absolute path of the root directory.
7. The hotspot detection system based on the domestic Shenwei platform according to claim 5 is characterized in that: Directory content retrieval and node construction are used to perform operations such as: L100, determine whether the queue structure is empty, if the queue structure is not empty, execute step L200; L200, the first element of the queue structure is dequeued, and the directory content of the first element is retrieved. If the directory content of the first element is not empty, step L300 is executed. If the directory content of the first element is empty, the directory content retrieval and node construction operation are terminated; L300. If the type of the directory content is a directory, construct a new node from the directory content and add the new node to the queue structure. Through queue management, traverse all subdirectories and files under the current directory, construct a directory tree structure of the new node, and record the directory tree structure of the new node in the log file. If the type of the directory content is a file, a function name search is performed on the functions in the file, and the function name search result of the file is recorded in a log file.
8. The hotspot detection system based on the domestic Shenwei platform according to claim 5 is characterized in that: When searching for function names, the directory content search and node construction modules are used to search for function names in files using regular expressions.
Citation Information
Patent Citations
Automatic fault positioning method based on Qt multi-process framework
CN118916236A
Data analysis method and device based on artificial intelligence, equipment and medium
CN119202910A