CN116540990A - Code integration method and device for realizing electronic product based on embedded mode - Google Patents

Code integration method and device for realizing electronic product based on embedded mode Download PDF

Info

Publication number
CN116540990A
CN116540990A CN202310786701.1A CN202310786701A CN116540990A CN 116540990 A CN116540990 A CN 116540990A CN 202310786701 A CN202310786701 A CN 202310786701A CN 116540990 A CN116540990 A CN 116540990A
Authority
CN
China
Prior art keywords
thread
embedded code
code
embedded
nodes
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
CN202310786701.1A
Other languages
Chinese (zh)
Other versions
CN116540990B (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.)
Guizhou Light Industry Technical College
Original Assignee
Guizhou Light Industry Technical College
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 Guizhou Light Industry Technical College filed Critical Guizhou Light Industry Technical College
Priority to CN202310786701.1A priority Critical patent/CN116540990B/en
Publication of CN116540990A publication Critical patent/CN116540990A/en
Application granted granted Critical
Publication of CN116540990B publication Critical patent/CN116540990B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/10Requirements analysis; Specification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to a code integration technology, and discloses a code integration method and a device based on embedded implementation of an electronic product, wherein the method comprises the following steps: acquiring task requirements of a product, and constructing an embedded code thread of the product according to the task requirements; performing static time analysis on the embedded code thread to obtain a thread transmission period, and performing thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread; judging the queue state of the optimized thread, and generating a transmission instruction according to the judging result of the queue state; after receiving the transmission instruction, performing reliability evaluation on the nodes in the embedded code thread to obtain evaluation parameters; and carrying out code path calculation on the embedded code thread according to the evaluation parameters, and selecting an object code generation path according to the result of the code path calculation. The invention can improve the efficiency and the safety of the embedded code integration method.

Description

Code integration method and device for realizing electronic product based on embedded mode
Technical Field
The present invention relates to the field of code integration technologies, and in particular, to a code integration method and apparatus for implementing an electronic product based on an embedded implementation.
Background
Embedded refers to a special computer system which is developed for an embedded system, uses an application as a center, uses computer technology as a base, and can flexibly cut out software and hardware modules according to user requirements (functions, reliability, cost, volume, power consumption, environment and the like). Because the embedded system has the characteristics of small volume, low power consumption, high integration level and the like, the embedded system is widely applied to a plurality of fields such as intelligent manufacturing, industrial control, aerospace, education and medical treatment and the like. The rapid development of intelligent science and technology brings convenience to life of people, but also causes security threat to electronic products comprising embedded systems, for example, a traditional embedded software automatic code generation method adopts a multi-model system modeling method, and a model constructed by the method integrates various model conversion methods and also analyzes the characteristics of a mixed model, but because the characteristics of the mixed model are excessive, the mixed model has complexity, the behavior response of the model is too slow when the embedded software code automatic generation method is called, and the risk of vulnerability generation of the model is increased; meanwhile, in order to consider convenience of hardware design, the conventional code integration method is less in terms of intelligent design. In summary, the existing embedded code integration method has the problem of low efficiency and security.
Disclosure of Invention
The invention provides a code integration method and device based on an embedded implementation electronic product, which mainly aim to solve the problems of low efficiency and safety of the embedded code integration method.
In order to achieve the above object, the present invention provides a code integration method based on embedded implementation of electronic products, including:
acquiring task requirements of a product, and constructing an embedded code thread of the product according to the task requirements;
performing static time analysis on the embedded code thread to obtain a thread transmission period, and performing thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread;
judging the queue state of the optimized thread, and generating a transmission instruction according to the judging result of the queue state;
after receiving the transmission instruction, performing index classification on the nodes in the embedded code thread to obtain the node reliability corresponding to the nodes; performing projection value calculation on the nodes according to the reliability to obtain node projection values; performing reliability evaluation on the node by using the node projection value to obtain an evaluation parameter;
Performing similarity calculation on the nodes of the embedded code threads to obtain node similarity parameters; performing path calculation on the embedded code according to the node similarity parameter and the evaluation parameter to obtain path coverage depth, and selecting an object code to generate a path according to the path coverage depth; the similarity calculation is carried out on the nodes of the embedded code threads by using the following formula:
wherein ,expressed as +.f in the embedded code thread>Node similarity parameters of the individual nodes; />Expressed as +.f in the embedded code thread>Position parameters of the initial code nodes; />Expressed as +.f in the embedded code thread>Position parameters of the end code nodes; />Representing the number of codes in the embedded code thread;
and carrying out path calculation on the embedded code according to the node similarity parameters and the evaluation parameters by using the following steps:
wherein ,expressed as the path coverage depth; />Representing the number of codes in the embedded code thread; />Representing the number of nodes in the embedded code thread; />Expressed as +.f in the embedded code thread >Node similarity parameters of the individual nodes; />Expressed as +.>Evaluation parameters of individual nodes.
Optionally, the building the embedded code thread of the product according to the task requirement includes:
collecting information according to the task demands to obtain demand information;
carrying out format conversion on the demand information to obtain a standard data set;
and generating thread nodes of the product according to the standard data set, and arranging the thread nodes in position to obtain the embedded code thread.
Optionally, the performing static time analysis on the embedded code thread to obtain a thread transmission period includes:
acquiring task time parameters of the embedded code thread, and periodically segmenting the embedded code thread according to the task time parameters to obtain a time stage;
calculating the task processing time duty ratio of the embedded code thread according to the time phase;
calculating the transmission period of the embedded code thread by using the following formula:
wherein ,a transmission period denoted as the embedded code thread; />Expressed as thread response time in the task time parameter; / >A task latency represented in the task time parameter; />A task execution time represented as a task execution time in the task time parameter; />A task amount represented as the embedded code thread; />Expressed as a thread width in the embedded code thread; />Expressed as the duty cycle of the task processing time;
And calculating the transmission period of the embedded code thread by using the duty ratio of the task processing time to obtain the thread transmission period.
Optionally, the performing, according to the transmission cycle, thread adjustment of task priority on the embedded code thread, to obtain an optimized thread, includes:
calculating the switching period of the embedded code thread according to the transmission period;
calculating the switching period of the embedded code thread according to the transmission period by using the following steps:
wherein ,a switching cycle represented as the embedded code thread; />A transmission period denoted as the embedded code thread; />The method comprises the steps of representing a preset task period;
and carrying out period adjustment on the embedded code thread by utilizing the switching period to obtain an optimized thread.
Optionally, the determining the queue status of the optimizing thread includes:
Performing queue space reading on the optimization thread to obtain space information;
when the space information indicates that the optimizing thread is in an idle state, generating a transmission instruction according to the optimizing thread;
and when the space information indicates that the optimizing thread is in a busy state, generating a waiting instruction according to the optimizing thread, and when the optimizing thread is in an idle state, generating a transmission instruction according to the optimizing thread.
Optionally, the generating a transmission instruction according to the optimizing thread includes:
creating an instruction object in the optimization thread;
and packaging the information of the instruction object to obtain a transmission instruction.
Optionally, the reliability evaluation is performed on the node by using the node projection value, so as to obtain an evaluation parameter, including:
grading the nodes by using the node projection values and a preset threshold range to obtain the grade corresponding to each node;
and generating an evaluation parameter of each node according to the grade corresponding to the node.
In order to solve the above problems, the present invention further provides a code integration device based on an embedded implementation electronic product, the device comprising:
The code thread construction module is used for acquiring task requirements of a product and constructing an embedded code thread of the product according to the task requirements;
the code thread optimizing module is used for carrying out static time analysis on the embedded code thread to obtain a thread transmission period, and carrying out thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread;
the transmission instruction generation module is used for judging the queue state of the optimization thread and generating a transmission instruction according to the result of the queue state judgment;
the reliability evaluation module is used for grading indexes of nodes in the embedded code thread after receiving the transmission instruction to obtain the node reliability corresponding to the nodes; performing projection value calculation on the nodes according to the reliability to obtain node projection values; performing reliability evaluation on the node by using the node projection value to obtain an evaluation parameter;
the code path calculation module is used for carrying out similarity calculation on the nodes of the embedded code threads to obtain node similarity parameters; and carrying out path calculation on the embedded code according to the node similarity parameter and the evaluation parameter to obtain a path coverage depth, and selecting an object code to generate a path according to the path coverage depth.
According to the embodiment of the invention, the transmission period of the embedded code thread can be predicted by carrying out static time analysis on the embedded code thread, and then the thread adjustment is carried out on the embedded code thread according to the transmission period, so that the time for executing tasks by the thread can be optimized, and the efficiency of the embedded code integration method is improved; the reliability evaluation is carried out on the nodes in the embedded code threads, so that the risk of the nodes can be reduced, and the safety of the embedded code threads is improved; and selecting an object code generation path according to the code path calculation result to obtain the shortest path for code generation, thereby improving the efficiency of the embedded code integration method. Therefore, the code integration method and the code integration device based on the embedded type implementation electronic product can solve the problem that the efficiency and the safety of the embedded type code integration method are low.
Drawings
Fig. 1 is a flow chart of a code integration method based on an embedded implementation electronic product according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of performing static time analysis on the embedded code thread to obtain a thread transmission period according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of performing reliability evaluation on nodes in the embedded code thread after receiving the transmission instruction according to an embodiment of the present invention to obtain evaluation parameters;
Fig. 4 is a functional block diagram of a code integration device based on an embedded implementation electronic product according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a code integration method based on embedded implementation of electronic products. The execution main body of the code integration method based on the embedded implementation electronic product comprises, but is not limited to, at least one of a server side, a terminal and the like which can be configured to execute the method provided by the embodiment of the application. In other words, the code integration method based on the embedded implementation electronic product may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (ContentDelivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, a flowchart of a code integration method based on embedded implementation of an electronic product according to an embodiment of the present invention is shown. In this embodiment, the code integration method based on the embedded implementation electronic product includes:
s1, acquiring task requirements of a product, and constructing an embedded code thread of the product according to the task requirements.
In the embodiment of the invention, the task requirement of the product is requirement information related to the embedded code of the product, wherein the product is provided with a Main line control program and has a unique identifier, for example, a Main function and a UI (user interface) are both components in the Main line control program; the relation between the embedded code thread and the main thread control program is that the main thread and the sub thread are connected, wherein after the main thread and the sub thread are respectively started, the respective life cycle is not affected, and the sub thread can still continue executing tasks after the main thread is finished.
In the embodiment of the invention, the method for constructing the embedded code thread of the product according to the task requirement comprises the following steps:
collecting information according to the task demands to obtain demand information;
Carrying out format conversion on the demand information to obtain a standard data set;
and generating thread nodes of the product according to the standard data set, and arranging the thread nodes in position to obtain the embedded code thread.
In the embodiment of the invention, the information collection is to collect the information such as the production flow parameters of the product, the function parameters of the production data and the like according to the task demand information, for example, the demand information comprises the production data of the product, a database table list in the production data of the product, a thread code related to the product and the like; the format conversion is to uniformly convert the data types of the demand information according to the data formats in the main thread, because the formats of the demand information are complex and various, if the format uniform processing is not performed, the main thread processing efficiency of the product is reduced; each DBMS (DataBase Management System ) defines a respective set of data type criteria for the purpose of meeting data processing requirements of the product, e.g., numeric data including integer, real, floating point, double precision, etc., which may be unified into an integer format of eight bytes when being formatted; the thread node is a server running a thread, one thread node can contain a plurality of servers, but one thread node can only run one process of the product where the thread is the minimum scheduling unit for running and executing the process.
In the embodiment of the invention, the position arrangement of the thread nodes can be performed according to the calculated mapping relation between the standard data set and the database of the product, wherein the mapping relation is expressed as the relation between each component field in the standard data set and the database, the standard data set can be split into a plurality of data sets, and field information except for key fields in the standard data set can be deleted in the splitting process, so that the data processing efficiency is improved; and writing the mapping relation corresponding to the Thread node by utilizing a Runneable interface (Thread auxiliary interface function) in the database to obtain a Thread object, and then calling a start () method of the Thread object to start the Thread to obtain the embedded code Thread.
It should be noted that, the mapping relationship between the standard data set and the database of the product may be obtained by calculating the matching degree between the data field in the standard data set and the table field in the database of the product, that is, if the matching degree between the data field in the standard data set and the table field in the database of the product is greater than the preset matching degree, the mapping relationship between the data field corresponding to the data and the database of the product is established. Optionally, the matching degree between the data field in the standard data set and the table field in the database of the product may be calculated by a matching degree algorithm, for example, a euclidean distance algorithm, where the preset matching degree may be set to 0.88, or may be set according to an actual scene; and when the mapping relation is obtained, the data in the standard data set exceeding the preset matching degree are arranged according to the matching degree from the large to the small.
Further, in an alternative embodiment of the present invention, the thread node for generating the product according to the standard data set includes: and identifying the data type of each data in the standard data set, determining the data attribute of each data in the standard data set according to the data type, determining the data task of the standard data set according to the data attribute, and constructing the thread node of the product based on the data task.
The data type refers to an identity information dimension used for representing each data in the standard data set, such as financial data types, medical data types and the like, and specifically, the data type can be obtained by a method of inquiring a field type of each data in the standard data set; the data attribute refers to data characteristic information, such as date, ID and the like, of each data in the standard data set, and specifically, the data attribute can be determined by an attribute identification tool; the data task may be understood as a user demand task, such as a query, statistics, etc., for determining that each data in the standard dataset needs to be executed; the thread nodes of the product may be compiled in a programming language, such as Java.
S2, performing static time analysis on the embedded code thread to obtain a thread transmission period, and performing thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread.
In the embodiment of the invention, the static time analysis is to statically analyze the time behavior of the embedded code thread, namely analyze the embedded code thread without executing the embedded code program of the product, and predict the time of the embedded code thread, for example, the task requirement of the product contains time limitation which must be completed within a limited period; static time analysis has a predictive role, the key issue being to calculate the maximum execution time of the embedded code thread.
Referring to fig. 2, in the embodiment of the present invention, the performing static time analysis on the embedded code thread to obtain a thread transmission period includes:
s21, acquiring task time parameters of the embedded code thread, and periodically segmenting the embedded code thread according to the task time parameters to obtain a time stage;
s22, calculating the task processing time duty ratio of the embedded code thread according to the time phase;
S23, calculating the transmission period of the embedded code thread by using the task processing time duty ratio to obtain the thread transmission period.
In an embodiment of the present invention, the task time parameter of the embedded code thread includes a plurality of time parameters, where the time parameters may be updated during the execution of the embedded code thread, and the task time parameter includes: the task submitting time of the product, the time when the embedded code thread receives the submitted task, the time when the task processing of the embedded code thread is finished, the task sleeping time and the like; the task sleep time can be used for adjusting the sleep frequency of the task executed by the embedded code thread; since the task types executed by the embedded code threads are different, they can be mainly classified into two types: the longer the task sleep time, the more the task type that is currently executed by the embedded code thread tends to be IO-intensive.
In the embodiment of the invention, the time phase can be divided into three phases, namely thread response time, task waiting time and task execution time; the thread response time refers to the time from the task of submitting the embedded code thread to the time when the embedded code thread adds the task into the thread, the task waiting time refers to the time from the task adding of the embedded code thread to the time when the thread starts to execute the task, and the task execution time refers to the time from the task processing of the embedded code thread to the task processing completion.
In the embodiment of the invention, the task processing time duty ratio is a ratio of calculating the average processing time of the current task in the embedded code thread to the average processing time of the last task in the embedded code thread, and when the duty ratio is more than 2%, the average processing time of the task executed by the embedded code thread is changed greatly, the step size of the embedded code thread needs to be adjusted, and the step size can be increased or reduced to adjust the embedded code thread until the duty ratio is less than 2%.
In the embodiment of the invention, the transmission period of the embedded code thread is calculated by using the following formula:
wherein ,a transmission period denoted as the embedded code thread; />Represented as any of theThread response time in the business time parameter; />A task latency represented in the task time parameter; />A task execution time represented as a task execution time in the task time parameter; />A task amount represented as the embedded code thread; />Expressed as a thread width in the embedded code thread; />Represented as the task processing time duty cycle.
In the embodiment of the present invention, the performing, according to the transmission period, thread adjustment of task priority on the embedded code thread to obtain an optimized thread includes:
Calculating the switching period of the embedded code thread according to the transmission period;
and carrying out period adjustment on the embedded code thread by utilizing the switching period to obtain an optimized thread.
In the embodiment of the invention, the switching period of the embedded code thread is calculated according to the transmission period by using the following formula:
wherein ,a switching cycle represented as the embedded code thread; />A transmission period denoted as the embedded code thread; />Represented as a preset duty cycle.
In the embodiment of the invention, the optimizing thread carries out line adjustment on the execution task in the embedded code thread according to the switching period, firstly carries out thread response time analysis on the task corresponding to the largest switching period, compares the thread response time corresponding to the event queue in the task, sets the event queue as a high priority event and a low priority event according to the length of the task time limit, and preferentially processes the execution task of the embedded code thread corresponding to the high priority event to finish thread adjustment.
S3, judging the queue state of the optimized thread, and generating a transmission instruction according to the judging result of the queue state.
In the embodiment of the present invention, the queue status judgment for the optimized thread includes:
performing queue space reading on the optimization thread to obtain space information;
when the space information indicates that the optimizing thread is in an idle state, generating a transmission instruction according to the optimizing thread;
and when the space information indicates that the optimizing thread is in a busy state, generating a waiting instruction according to the optimizing thread, and when the optimizing thread is in an idle state, generating a transmission instruction according to the optimizing thread.
In the embodiment of the invention, a state variable method can be adopted for space reading, and node state variables of the optimization thread are firstly selected, wherein the node state variables refer to variables which can influence space information of the optimization thread, such as time variables; then, using a thread.getState () function to perform state reading on the node state variables to obtain the space information; the transmission instruction is a wake-up instruction for starting the embedded code thread, and when the optimizing thread receives the instruction, the optimizing thread wakes up the embedded code thread to perform the next execution action.
In an embodiment of the present invention, the generating a transmission instruction according to the optimization thread includes:
creating an instruction object in the optimization thread;
and packaging the information of the instruction object to obtain a transmission instruction.
In the embodiment of the invention, the instruction object is the carrier for transmitting the instruction; the generating process of the transmission instruction may be that a carrier of the transmission instruction is created in the optimizing thread, and then the transmission information is added into the carrier, so as to obtain the transmission instruction generated according to the optimizing thread; the information encapsulation firstly needs to convert the transmission information into binary data, then data segmentation is carried out on the binary data to obtain transmission data segments, TCP/IP network protocol encapsulation is carried out on the head parts of the transmission data segments to obtain encapsulation data segments, and finally format conversion is carried out on the encapsulation data segments, wherein the format conversion is to convert a bit stream form formed by the encapsulation data segments into a transmission signal form, and the transmission instruction is obtained.
And S4, performing reliability evaluation on the nodes in the embedded code thread after receiving the transmission instruction to obtain evaluation parameters.
Referring to fig. 3, in the embodiment of the present invention, reliability evaluation is performed on a node in the embedded code thread after receiving the transmission instruction to obtain an evaluation parameter, which includes:
S31, carrying out index classification on the nodes in the embedded code thread to obtain the node reliability corresponding to the nodes;
s32, calculating a projection value of the node according to the reliability to obtain a node projection value;
and S33, performing reliability evaluation on the node by using the node projection value to obtain an evaluation parameter.
In the embodiment of the invention, the index classification is to divide the nodes according to preset reliability indexes, wherein the reliability indexes comprise qualified indexes and unqualified indexes, the qualified indexes comprise high reliability, medium reliability and slight reliability, and the unqualified indexes comprise high unreliability, medium unreliability and slight unreliability; and then, adopting a dimension information projection method to convert the data information in the nodes into a low-dimensional space by a projection method to obtain the projection value of each node.
In the embodiment of the present invention, the reliability evaluation is performed on the node by using the node projection value to obtain an evaluation parameter, including:
grading the nodes by using the node projection values and a preset threshold range to obtain the grade corresponding to each node;
and generating an evaluation parameter of each node according to the grade corresponding to the node.
In the embodiment of the present invention, the reliability evaluation is that the nodes are classified according to the size of the node projection value and a preset threshold range, where the threshold range is a first class (0.8,1), a second class (0.6,0.8), a third class (0.4,0.6) and a fourth class (0,0.4), when the node projection value is in the first class, the evaluation parameter of the node is 1, when the node projection value is in the second class, the evaluation parameter of the node is 0.8, when the node projection value is in the third class, the evaluation parameter of the node is 0.6, and when the node projection value is in the fourth class, the evaluation parameter of the node is 0.4, for example, the projection value of the node is 0.85, in the first class range, so that the evaluation parameter of the node is 0.8, and the greater the node projection value corresponding to the node indicates that the reliability of the node is greater.
The low-dimensional space can be a two-dimensional space, the data information in the nodes is three-dimensional coordinate data, and the nodes are mapped and calculated according to the three-dimensional coordinate data to obtain projection values of the nodes; for example, the node may be represented by a vector according to the three-dimensional coordinate parameter, so as to obtain a representation vector of the node, and the projection line may be calculated for the node according to the representation vector, so as to obtain a projection value of the node.
S5, performing code path calculation on the embedded code thread according to the evaluation parameters, and selecting an object code generation path according to a code path calculation result.
In an embodiment of the present invention, the performing a code path calculation on the embedded code thread according to the evaluation parameter includes:
performing similarity calculation on the nodes of the embedded code threads to obtain node similarity parameters;
and carrying out path calculation on the embedded code according to the node similarity parameter and the evaluation parameter to obtain the path coverage depth.
In the embodiment of the invention, the similarity calculation is performed on the nodes of the embedded code thread by using the following formula:
wherein ,expressed as +.f in the embedded code thread>Node similarity parameters of the individual nodes; />Expressed as +.f in the embedded code thread>Position parameters of the initial code nodes; />Expressed as +.f in the embedded code thread>Position parameters of the end code nodes; />Expressed as the number of codes in the embedded code thread.
In the embodiment of the invention, the path calculation is performed on the embedded code according to the node similarity parameter and the evaluation parameter by using the following steps:
wherein ,expressed as the path coverage depth; />Representing the number of codes in the embedded code thread; />Representing the number of nodes in the embedded code thread; />Expressed as +.f in the embedded code thread>Node similarity parameters of the individual nodes; />Expressed as +.>Evaluation parameters of individual nodes.
In the embodiment of the invention, the target code generation path is selected according to the path coverage depth, the path coverage depth of each code generation path in the embedded code thread is calculated, and then the code generation path corresponding to the maximum path coverage depth is selected as the target code generation path, namely the shortest path generated by the code of the product.
The invention provides a code integration method based on an embedded implementation electronic product, which can predict the transmission period of an embedded code thread by carrying out static time analysis on the embedded code thread, then carry out thread adjustment on the embedded code thread according to the transmission period, optimize the time of executing tasks by the thread and improve the efficiency of the embedded code integration method; the reliability evaluation is carried out on the nodes in the embedded code threads, so that the risk of the nodes can be reduced, and the safety of the embedded code threads is improved; and selecting an object code generation path according to the code path calculation result to obtain the shortest path for code generation, thereby improving the efficiency of the embedded code integration method. Therefore, the code integration method based on the embedded implementation electronic product can solve the problems of low efficiency and low safety of the embedded code integration method.
Fig. 4 is a functional block diagram of a code integration device based on an embedded implementation electronic product according to an embodiment of the present invention.
The code integration device 400 based on the embedded implementation of the electronic product can be installed in electronic equipment. Depending on the implemented functions, the code integration apparatus 400 based on the embedded implementation electronic product may include a code thread construction module 401, a code thread optimization module 402, a transmission instruction generation module 403, a reliability evaluation module 404, and a code path calculation module 405. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the code thread construction module 401 is configured to obtain a task requirement of a product, and construct an embedded code thread of the product according to the task requirement;
the code thread optimizing module 402 is configured to perform static time analysis on the embedded code thread to obtain a thread transmission period, and perform thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread;
The transmission instruction generating module 403 is configured to perform queue status judgment on the optimization thread, and generate a transmission instruction according to a result of the queue status judgment;
the reliability evaluation module 404 is configured to perform index classification on a node in the embedded code thread after receiving the transmission instruction, so as to obtain node reliability corresponding to the node; performing projection value calculation on the nodes according to the reliability to obtain node projection values; performing reliability evaluation on the node by using the node projection value to obtain an evaluation parameter;
the code path calculation module 405 is configured to perform similarity calculation on nodes of the embedded code thread to obtain node similarity parameters; and carrying out path calculation on the embedded code according to the node similarity parameter and the evaluation parameter to obtain a path coverage depth, and selecting an object code to generate a path according to the path coverage depth.
In detail, each module in the code integration device 400 based on the embedded implementation electronic product in the embodiment of the present invention adopts the same technical means as the code integration method based on the embedded implementation electronic product in the drawings when in use, and can generate the same technical effects, which is not described herein.
The embodiment of the invention provides electronic equipment based on code integration of an electronic product.
The electronic device may include a processor, a memory, a communication bus, and a communication interface, and may further include a computer program stored in the memory and executable on the processor, such as a code integration program for implementing an electronic product based on an embedded type.
The processor may be formed by an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be formed by a plurality of integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing Unit, CPU), a microprocessor, a digital processing chip, a graphics processor, a combination of various control chips, and the like. The processor is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, executes or executes programs or modules stored in the memory (for example, executes code integration programs based on embedded implementation of electronic products, etc.), and invokes data stored in the memory to perform various functions of the electronic device and process data.
The memory includes at least one type of readable storage medium including flash memory, removable hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory may in other embodiments also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device. Further, the memory may also include both internal storage units and external storage devices of the electronic device. The memory may be used not only for storing application software installed in an electronic device and various types of data, for example, codes based on a code integration program for implementing an electronic product, etc., but also for temporarily storing data that has been output or is to be output.
The communication bus may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory and at least one processor or the like.
The communication interface is used for communication between the electronic equipment and other equipment, and comprises a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), or alternatively a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source may be logically connected to the at least one processor through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The code integration program stored in the memory of the electronic device and based on the embedded implementation electronic product is a combination of a plurality of instructions, and when running in the processor, the code integration program can be implemented:
acquiring task requirements of a product, and constructing an embedded code thread of the product according to the task requirements;
performing static time analysis on the embedded code thread to obtain a thread transmission period, and performing thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread;
judging the queue state of the optimized thread, and generating a transmission instruction according to the judging result of the queue state;
after receiving the transmission instruction, performing reliability evaluation on the nodes in the embedded code thread to obtain evaluation parameters;
and carrying out code path calculation on the embedded code thread according to the evaluation parameters, and selecting an object code generation path according to the result of the code path calculation.
Specifically, the specific implementation method of the above instruction by the processor may refer to descriptions of related steps in the corresponding embodiment of the drawings, which are not repeated herein.
Further, the electronic device integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
acquiring task requirements of a product, and constructing an embedded code thread of the product according to the task requirements;
performing static time analysis on the embedded code thread to obtain a thread transmission period, and performing thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread;
judging the queue state of the optimized thread, and generating a transmission instruction according to the judging result of the queue state;
After receiving the transmission instruction, performing reliability evaluation on the nodes in the embedded code thread to obtain evaluation parameters;
and carrying out code path calculation on the embedded code thread according to the evaluation parameters, and selecting an object code generation path according to the result of the code path calculation.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (8)

1. A code integration method for implementing an electronic product based on an embedded type, the method comprising:
acquiring task requirements of a product, and constructing an embedded code thread of the product according to the task requirements;
performing static time analysis on the embedded code thread to obtain a thread transmission period, and performing thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread;
judging the queue state of the optimized thread, and generating a transmission instruction according to the judging result of the queue state;
after receiving the transmission instruction, performing index classification on the nodes in the embedded code thread to obtain the node reliability corresponding to the nodes; performing projection value calculation on the nodes according to the reliability to obtain node projection values; performing reliability evaluation on the node by using the node projection value to obtain an evaluation parameter;
Performing similarity calculation on the nodes of the embedded code threads to obtain node similarity parameters; performing path calculation on the embedded code according to the node similarity parameter and the evaluation parameter to obtain path coverage depth, and selecting an object code to generate a path according to the path coverage depth; the similarity calculation is carried out on the nodes of the embedded code threads by using the following formula:
wherein ,expressed as +.f in the embedded code thread>Node similarity parameters of the individual nodes; />Expressed as +.f in the embedded code thread>Position parameters of the initial code nodes; />Expressed as +.f in the embedded code thread>Position parameters of the end code nodes; />Representing the number of codes in the embedded code thread;
and carrying out path calculation on the embedded code according to the node similarity parameters and the evaluation parameters by using the following steps:
wherein ,expressed as the path coverage depth; />Representing the number of codes in the embedded code thread; />Representing the number of nodes in the embedded code thread; />Expressed as +.f in the embedded code thread >Node similarity parameters of the individual nodes; />Expressed as +.>Evaluation parameters of individual nodes.
2. The code integration method based on embedded implementation of electronic products according to claim 1, wherein the building of the embedded code thread of the product according to the task requirement comprises:
collecting information according to the task demands to obtain demand information;
carrying out format conversion on the demand information to obtain a standard data set;
and generating thread nodes of the product according to the standard data set, and arranging the thread nodes in position to obtain the embedded code thread.
3. The code integration method based on embedded implementation electronics of claim 1 wherein the performing static time analysis on the embedded code thread to obtain a thread transmission period comprises:
acquiring task time parameters of the embedded code thread, and periodically segmenting the embedded code thread according to the task time parameters to obtain a time stage;
calculating the task processing time duty ratio of the embedded code thread according to the time phase;
calculating the transmission period of the embedded code thread by using the following formula:
wherein ,a transmission period denoted as the embedded code thread; />Expressed as thread response time in the task time parameter; />A task latency represented in the task time parameter; />A task execution time represented as a task execution time in the task time parameter; />A task amount represented as the embedded code thread; />Expressed as a thread width in the embedded code thread; />Expressed as the task processing time duty cycle;
and calculating the transmission period of the embedded code thread by using the duty ratio of the task processing time to obtain the thread transmission period.
4. The method for integrating codes based on embedded electronic products according to claim 1, wherein said performing a thread adjustment of task priority on said embedded code thread according to said transmission cycle, to obtain an optimized thread, comprises:
calculating the switching period of the embedded code thread according to the transmission period;
calculating the switching period of the embedded code thread according to the transmission period by using the following steps:
wherein ,a switching cycle represented as the embedded code thread; />A transmission period denoted as the embedded code thread; / >The method comprises the steps of representing a preset task period;
and carrying out period adjustment on the embedded code thread by utilizing the switching period to obtain an optimized thread.
5. The code integration method based on embedded implementation of electronic products according to claim 1, wherein the performing queue status judgment on the optimization thread includes:
performing queue space reading on the optimization thread to obtain space information;
when the space information indicates that the optimizing thread is in an idle state, generating a transmission instruction according to the optimizing thread;
and when the space information indicates that the optimizing thread is in a busy state, generating a waiting instruction according to the optimizing thread, and when the optimizing thread is in an idle state, generating a transmission instruction according to the optimizing thread.
6. The code integration method based on embedded implementation electronics of claim 5 wherein generating a transmission instruction according to the optimization thread comprises:
creating an instruction object in the optimization thread;
and packaging the information of the instruction object to obtain a transmission instruction.
7. The code integration method based on embedded implementation electronic products of claim 1, wherein the reliability evaluation is performed on the node by using the node projection value to obtain an evaluation parameter, including:
Grading the nodes by using the node projection values and a preset threshold range to obtain the grade corresponding to each node;
and generating an evaluation parameter of each node according to the grade corresponding to the node.
8. A code integration apparatus for implementing an electronic product based on an embedded type, the apparatus comprising:
the code thread construction module is used for acquiring task requirements of a product and constructing an embedded code thread of the product according to the task requirements;
the code thread optimizing module is used for carrying out static time analysis on the embedded code thread to obtain a thread transmission period, and carrying out thread adjustment of task priority on the embedded code thread according to the transmission period to obtain an optimized thread;
the transmission instruction generation module is used for judging the queue state of the optimization thread and generating a transmission instruction according to the result of the queue state judgment;
the reliability evaluation module is used for grading indexes of nodes in the embedded code thread after receiving the transmission instruction to obtain the node reliability corresponding to the nodes; performing projection value calculation on the nodes according to the reliability to obtain node projection values; performing reliability evaluation on the node by using the node projection value to obtain an evaluation parameter;
The code path calculation module is used for carrying out similarity calculation on the nodes of the embedded code threads to obtain node similarity parameters; performing path calculation on the embedded code according to the node similarity parameter and the evaluation parameter to obtain path coverage depth, and selecting an object code to generate a path according to the path coverage depth; the similarity calculation is carried out on the nodes of the embedded code threads by using the following formula:
wherein ,expressed as +.f in the embedded code thread>Node similarity parameters of the individual nodes; />Expressed as +.f in the embedded code thread>Position parameters of the initial code nodes; />Expressed as +.f in the embedded code thread>Position parameters of the end code nodes; />Representing the number of codes in the embedded code thread;
and carrying out path calculation on the embedded code according to the node similarity parameters and the evaluation parameters by using the following steps:
wherein ,expressed as the path coverage depth; />Representing the number of codes in the embedded code thread; />Representing the number of nodes in the embedded code thread; />Expressed as +.f in the embedded code thread >Node similarity parameters of the individual nodes; />Expressed as +.>Evaluation parameters of individual nodes.
CN202310786701.1A 2023-06-30 2023-06-30 Code integration method and device for realizing electronic product based on embedded mode Active CN116540990B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310786701.1A CN116540990B (en) 2023-06-30 2023-06-30 Code integration method and device for realizing electronic product based on embedded mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310786701.1A CN116540990B (en) 2023-06-30 2023-06-30 Code integration method and device for realizing electronic product based on embedded mode

Publications (2)

Publication Number Publication Date
CN116540990A true CN116540990A (en) 2023-08-04
CN116540990B CN116540990B (en) 2023-09-01

Family

ID=87445625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310786701.1A Active CN116540990B (en) 2023-06-30 2023-06-30 Code integration method and device for realizing electronic product based on embedded mode

Country Status (1)

Country Link
CN (1) CN116540990B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080028415A1 (en) * 2000-06-02 2008-01-31 Honeywell International Inc. Methods and Apparatus for Sharing Slack in a Time-Partitioned System
CN101208674A (en) * 2005-06-23 2008-06-25 赫优讯自动化系统有限公司 Method for data communication of bus users in an open automation system
CN113032215A (en) * 2021-03-24 2021-06-25 北京字节跳动网络技术有限公司 Thread snapshot analysis method, device, equipment and storage medium
CN114064046A (en) * 2021-11-11 2022-02-18 昆明理工大学 Method and device for determining code generation quality and efficiency evaluation value based on multiple indexes

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080028415A1 (en) * 2000-06-02 2008-01-31 Honeywell International Inc. Methods and Apparatus for Sharing Slack in a Time-Partitioned System
CN101208674A (en) * 2005-06-23 2008-06-25 赫优讯自动化系统有限公司 Method for data communication of bus users in an open automation system
CN113032215A (en) * 2021-03-24 2021-06-25 北京字节跳动网络技术有限公司 Thread snapshot analysis method, device, equipment and storage medium
CN114064046A (en) * 2021-11-11 2022-02-18 昆明理工大学 Method and device for determining code generation quality and efficiency evaluation value based on multiple indexes

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
FREY_LIU: "嵌入式问题分析思路", HTTPS://BLOG.CSDN.NET/HELAISUN/ARTICLE/DETAILS/122718271 *
RWESTMSFT 等: "Thread and task architecture guide", HTTPS://LEARN.MICROSOFT.COM/EN-US/SQL/RELATIONAL-DATABASES/THREAD-AND-TASK-ARCHITECTURE-GUIDE?VIEW=SQL-SERVER-VER16 *
周锋: "智能代理技术在网络管理中的应用与仿真实现", 中国优秀硕士学位论文全文数据库 (信息科技辑), pages 139 - 106 *

Also Published As

Publication number Publication date
CN116540990B (en) 2023-09-01

Similar Documents

Publication Publication Date Title
WO2015094269A1 (en) Hybrid flows containing a continuous flow
CN105574032A (en) Rule matching operation method and device
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN116610731B (en) Big data distributed storage method and device, electronic equipment and storage medium
CN117271101B (en) Operator fusion method and device, electronic equipment and storage medium
CN109840141A (en) Thread control method, device, electronic equipment and storage medium based on cloud monitoring
CN111768096A (en) Rating method and device based on algorithm model, electronic equipment and storage medium
CN116540990B (en) Code integration method and device for realizing electronic product based on embedded mode
CN112269875A (en) Text classification method and device, electronic equipment and storage medium
CN109947736B (en) Method and system for real-time computing
CN112560416B (en) Page chart generation method and device, electronic equipment and storage medium
CN116108276A (en) Information recommendation method and device based on artificial intelligence and related equipment
CN114547011A (en) Data extraction method and device, electronic equipment and storage medium
CN113704616B (en) Information pushing method and device, electronic equipment and readable storage medium
CN111143328A (en) Agile business intelligent data construction method, system, equipment and storage medium
CN112214556B (en) Label generation method, label generation device, electronic equipment and computer readable storage medium
CN113704411B (en) Word vector-based similar guest group mining method, device, equipment and storage medium
CN110162487A (en) A kind of express statistic number of repetition method, apparatus and storage medium
CN112328960B (en) Optimization method and device for data operation, electronic equipment and storage medium
CN116257488B (en) Geotechnical engineering investigation big data archiving method, device, electronic equipment and medium
CN113032168B (en) Data transmission rate dynamic adjustment method and device, electronic equipment and storage medium
US11934963B2 (en) Information processing method, non-transitory storage medium and information processing device
WO2022160443A1 (en) Lineage mining method and apparatus, electronic device and computer-readable storage medium
CN114819590A (en) Intelligent strategy recommendation method, device, equipment and storage medium
CN116823518A (en) Method and system for performing semantic dimension decoupling on power metering mass data

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
GR01 Patent grant