CN116744168A - Log storage method and related device - Google Patents

Log storage method and related device Download PDF

Info

Publication number
CN116744168A
CN116744168A CN202211066944.XA CN202211066944A CN116744168A CN 116744168 A CN116744168 A CN 116744168A CN 202211066944 A CN202211066944 A CN 202211066944A CN 116744168 A CN116744168 A CN 116744168A
Authority
CN
China
Prior art keywords
output number
output
log
preset threshold
task
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
CN202211066944.XA
Other languages
Chinese (zh)
Other versions
CN116744168B (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.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211066944.XA priority Critical patent/CN116744168B/en
Publication of CN116744168A publication Critical patent/CN116744168A/en
Application granted granted Critical
Publication of CN116744168B publication Critical patent/CN116744168B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R1/00Details of transducers, loudspeakers or microphones
    • H04R1/10Earpieces; Attachments therefor ; Earphones; Monophonic headphones
    • H04R1/1041Mechanical or electronic switches, or control elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R2201/00Details of transducers, loudspeakers or microphones covered by H04R1/00 but not provided for in any of its subgroups
    • H04R2201/10Details of earpieces, attachments therefor, earphones or monophonic headphones covered by H04R1/10 but not provided for in any of its subgroups

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Acoustics & Sound (AREA)
  • Signal Processing (AREA)
  • Headphones And Earphones (AREA)
  • Telephone Function (AREA)

Abstract

The application provides a log storage method and a related device, which are beneficial to improving the accuracy of controlling log streams, and further avoid the condition of log loss caused by insufficient flash memory space. The method comprises the following steps: at a first moment, determining a first output quantity and a second output quantity of logs in the wireless earphone, which are output from a memory to a flash memory; and determining whether to continue outputting the log to the flash memory according to the first output number and the second output number. The first output number is the output number in a first period taking the first moment as the end moment, and the second output number is the output number in a second period taking the first moment as the end moment, and the time length of the second period is longer than that of the first period.

Description

Log storage method and related device
Technical Field
The present application relates to the field of terminals, and in particular, to a log storage method and a related device.
Background
Typically, a wireless headset, such as a truly wireless stereo (true wireless stereo, TWS) headset, will log the task and store the log in memory. And a developer can position the problem of the TWS earphone according to the stored log and maintain and test the TWS earphone. However, there may be a loss of the log stored in the memory, for example, a portion of the log stored in the memory may be deleted when the TWS headset is powered down. Therefore, the TWS may output the log in the memory to a flash memory (flash), and the log stored in the flash memory is always saved as long as it is not covered.
Because the flash memory space of the TWS earphone is limited, if too many logs are output, the logs in the flash memory are covered, the time length of storing the logs is limited, and therefore the TWS earphone needs to control the quantity of the logs output from the memory to the flash memory. The current log stream control mechanism pays attention to the number of the logs output instantaneously, and the situation that the control of the log stream is inaccurate can cause insufficient space of a flash memory, so that the logs are lost.
Disclosure of Invention
The application provides a log storage method and a related device, which are beneficial to improving the accuracy of controlling log streams and further avoiding the condition of log loss caused by insufficient flash memory space.
In a first aspect, a log storage method is provided, including: determining a first output number and a second output number of logs in the wireless earphone from the memory to the flash memory; and determining whether to continue outputting the log to the flash memory according to the first output number and the second output number.
The first output number is the output number in a first period taking the first moment as the end moment, the second output number is the output number in a second period taking the first moment as the end moment, the first moment is the current system time, and the time length of the second period is longer than the time length of the first period.
In the present application, the first output number is the output number of the log in a short time, and the second output number is the output number of the log in a long time. Wherein the short time may include one second, two seconds, three seconds, etc., and the long time may include the last one minute, the last two minutes, the last three minutes, etc.
Taking a short time of one second and a long time of the last minute as an example, if the current system time is the t second, the first period is the t second, the duration of the first period is the one second, the second period is the last minute of the t second, the duration of the second period is less than or equal to one minute, the first time is the ending time of the t second, the first output number is the output number in the t second of which the log is the ending time of the t second, and the second output number is the output number of the log in the last minute before the t second including the t second.
Taking the example that the short time is three seconds and the long time is the last three minutes, if the current system time is the t second, the first time period is a period from the t-2 th second to the t second, the duration of the first time period is 3 seconds, the second time period is the last three minutes of the t second, the duration of the second time period is less than or equal to three minutes, the first time is the time when the t second ends, the first output quantity is the output quantity of the log in the three seconds from the t-2 th second to the t second, and the second output quantity is the output quantity of the log in the last three minutes before the t second including the t second.
According to the method, the output quantity of the logs is comprehensively considered from two dimensions of short time and long time, so that the control of the wireless earphone on the output of the logs is more comprehensive and accurate, the situation that a large amount of logs are written in a short time and the frequently executed tasks are controlled to output the logs is favorably restrained, and the situation that the logs are lost due to insufficient flash memory space is avoided.
With reference to the first aspect, in certain implementation manners of the first aspect, the log includes a log corresponding to each of at least one task, and determining a first output number and a second output number of the log in the wireless headset from the memory to the flash memory includes: a first output number and a second output number of a log of a first task in the wireless headset from the memory to the flash memory are determined, the first task being any one of the at least one task.
In the application, different task scenes need to pay attention to different output thresholds, so the wireless earphone manages the output quantity of the logs by taking the task as a dimension, and different tasks can correspond to different log flow control mechanisms. Therefore, the granularity of the wireless earphone for controlling the output quantity of the logs is finer, the wireless earphone is more specific, and a developer can adjust the output threshold of the logs by taking tasks as granularity, so that the expected maintenance effect and test effect are achieved.
With reference to the first aspect, in certain implementations of the first aspect, a first preset threshold and a second preset threshold of the first task are determined. Determining whether to continue outputting the log to the flash memory according to the first output number and the second output number, including: and determining whether to continue outputting the log to the flash memory according to the first output number, the second output number, the first preset threshold value and the second preset threshold value.
In the application, the first preset threshold value is a short-time output threshold value, the second preset threshold value is a long-time output threshold value, the wireless earphone controls the output quantity of the first task in a short time through the first preset threshold value, and controls the output quantity of the first task in a long time through the second preset threshold value, so that the output of the log of the first task can be controlled in two aspects of long time and short time, and the accuracy of the control of the log flow of the first task is improved.
With reference to the first aspect, in certain implementation manners of the first aspect, determining whether to continue outputting the log to the flash memory according to the first output number, the second output number, the first preset threshold value, and the second preset threshold value includes: if the first output number is smaller than a first preset threshold value and the second output number is smaller than a second preset threshold value, determining to continue outputting logs to the flash memory; or if the first output number is greater than or equal to the first preset threshold value, and/or if the second output number is greater than or equal to the second preset threshold value, determining to limit the continuous output of the log to the flash memory.
In the application, if one of the first output number and the second output number exceeds the preset threshold, the wireless earphone limits the output of the log of the first task, so that the problem that the log space is insufficient due to the fact that the first task frequently prints a large number of logs in a short time or the log output of the frequently executed first task is controlled is avoided.
With reference to the first aspect, in certain implementation manners of the first aspect, after determining to limit the continuous output of the log to the flash memory, the method further includes: determining a third output number and a fourth output number of logs in the wireless earphone from the memory to the flash memory; and determining whether to resume the continuous output of the log to the flash memory according to the third output number, the fourth output number, the first preset threshold value and the second preset threshold value.
Wherein the third output number is the output number in a third period taking the second time as the end time, and the fourth output number is the output number in a fourth period taking the second time as the end time; the duration of the fourth period is longer than the duration of the third period; the second time is after the first time.
In the application, the wireless earphone starts log recording at the second moment, and if the wireless earphone limits the log of the first task to continue to be output to the memory at the first moment, the wireless earphone continuously determines whether to resume the log to continue to be output to the memory according to the third output number, the fourth output number, the first preset threshold value and the second preset threshold value.
With reference to the first aspect, in certain implementation manners of the first aspect, determining whether to resume outputting the log to the flash memory according to the third output number, the fourth output number, the first preset threshold value, and the second preset threshold value includes: determining a third preset threshold according to the second preset threshold; if the third output number is smaller than the first preset threshold value and the fourth output number is smaller than the third preset threshold value, determining to resume outputting the log to the flash memory continuously; or if the third output number is greater than or equal to the first preset threshold value, and/or the fourth output number is greater than or equal to the third preset threshold value, determining to limit the continuous output of the log to the flash memory.
In the application, if the third output number and the fourth output number of the logs of the first task determined at the second moment do not exceed the corresponding preset thresholds, the wireless earphone can remove the limitation on the first task and resume the continuous output of the logs of the first task to the memory. But if either the third output number or the fourth output number exceeds a corresponding preset threshold, the wireless headset determines that outputting the log of the first task to the memory is still limited.
Illustratively, the third preset threshold may be seven-eighth of the second preset threshold, but embodiments of the present application are not limited thereto.
With reference to the first aspect, in some implementations of the first aspect, at least one task further includes a second task, where a first preset threshold of the second task is different from a first preset threshold of the first task, and/or a second preset threshold of the second task is different from a second preset threshold of the first task.
In the application, the first task and the second task are two different tasks, and the wireless earphone is provided with a short-time output threshold and a long-time output threshold for each task, the first preset threshold represents the short-time output threshold, and the second preset threshold represents the long-time output threshold, so that the first preset threshold of the first task can be different from the preset threshold of the second task, and/or the second preset threshold of the first task can be different from the second preset threshold of the second task.
The present application does not exclude the case where different tasks have the same log output threshold, where the log output threshold includes a short time output threshold and a long time output threshold.
In a second aspect, there is provided a log storage device comprising: for performing the method in any of the possible implementations of the first aspect described above. In particular, the apparatus comprises means for performing the method in any one of the possible implementations of the first aspect described above.
In a third aspect, there is provided another log storage device comprising a processor and a memory, the processor being coupled to the memory, the memory being operable to store a computer program, the processor being operable to invoke and execute the computer program in the memory to implement the method of any of the possible implementations of the first aspect.
In one implementation, the log storage device is a wireless headset. When the log storage device is a wireless headset, the communication interface may be a transceiver, or an input/output interface.
In another implementation, the log storage device is a chip configured in a wireless headset. When the log storage device is a chip configured in a wireless headset, the communication interface may be an input/output interface.
In a fourth aspect, there is provided a processor comprising: input circuit, output circuit and processing circuit. The processing circuitry is configured to receive signals via the input circuitry and to transmit signals via the output circuitry such that the processor performs the method of any one of the possible implementations of the first aspect described above.
In a specific implementation process, the processor may be a chip, the input circuit may be an input pin, the output circuit may be an output pin, and the processing circuit may be a transistor, a gate circuit, a trigger, various logic circuits, and the like. The input signal received by the input circuit may be received and input by, for example and without limitation, a receiver, the output signal may be output by, for example and without limitation, a transmitter and transmitted by a transmitter, and the input circuit and the output circuit may be the same circuit, which functions as the input circuit and the output circuit, respectively, at different times. The specific implementation of the processor and various circuits is not limited by the present application.
In a fifth aspect, a processing device is provided that includes a processor and a memory. The processor is configured to read instructions stored in the memory and to receive signals via the receiver and to transmit signals via the transmitter to perform the method of any one of the possible implementations of the first aspect.
Optionally, the processor is one or more and the memory is one or more.
Alternatively, the memory may be integrated with the processor or the memory may be separate from the processor.
In a specific implementation process, the memory may be a non-transient (non-transitory) memory, for example, a Read Only Memory (ROM), which may be integrated on the same chip as the processor, or may be separately disposed on different chips.
It should be appreciated that the related data interaction process, for example, transmitting the indication information, may be a process of outputting the indication information from the processor, and the receiving the capability information may be a process of receiving the input capability information by the processor. Specifically, the data output by the processing may be output to the transmitter, and the input data received by the processor may be from the receiver. Wherein the transmitter and receiver may be collectively referred to as a transceiver.
The processing means in the fifth aspect may be a chip, and the processor may be implemented by hardware or by software, and when implemented by hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor, implemented by reading software code stored in a memory, which may be integrated in the processor, or may reside outside the processor, and exist separately.
In a sixth aspect, there is provided a computer program product comprising: computer program code which, when run, causes a computer to perform the method of any one of the possible implementations of the first aspect described above.
In a seventh aspect, a computer readable storage medium is provided, the computer readable storage medium storing a computer program which, when executed, causes a computer to perform the method of any one of the possible implementations of the first aspect.
Drawings
Fig. 1 is a schematic structural diagram of a wireless earphone according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a log storage method provided by an embodiment of the present application;
FIG. 3 is a schematic flow chart of another log storage method provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a statistics log output number in the last minute according to an embodiment of the present application;
fig. 5 is a schematic block diagram of a log storage device provided by the present application.
Detailed Description
The technical scheme of the application will be described below with reference to the accompanying drawings.
In order to clearly describe the technical solution of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same item or similar items having substantially the same function and effect. For example, the first task and the second task are for distinguishing between different tasks, and the order of the tasks is not limited. It will be appreciated by those of skill in the art that the words "first," "second," and the like do not limit the amount and order of execution, and that the words "first," "second," and the like do not necessarily differ.
In the present application, the words "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
Furthermore, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, and c may represent: a, b, or c, or a and b, or a and c, or b and c, or a, b and c, wherein a, b and c can be single or multiple.
Currently, some wireless headphones, such as a TWS headphone, have limited flash memory space, limiting the length of time the TWS headphone stores logs, and thus the TWS headphone needs to manage the amount of logs output from memory to flash memory. Current log stream management mechanisms focus on the number of logs output instantaneously, and not on the number of log outputs over a long period of time, illustratively, the number of logs output in one second and the number of logs output in one minute for a certain task. If the situation that the control of the log stream is inaccurate only by considering the number of the logs output instantaneously, the space of the flash memory is insufficient, and thus the logs are lost.
In view of this, the embodiment of the application provides a log storage method and a related device, and a wireless earphone can comprehensively manage and control log output according to the log output quantity in a short time and the log output quantity in a long time, so that the accuracy of managing and controlling log output is improved, and further the loss of the log caused by insufficient space of a flash memory is avoided.
In order to better understand the embodiments of the present application, the following describes the structure of the wireless earphone according to the embodiments of the present application. Fig. 1 is a schematic structural diagram of a wireless earphone according to an embodiment of the present application.
Illustratively, the wireless headset may include at least one processor 101, at least one memory 105, a bluetooth module 102, an audio module 103, a power module 104, an input/output interface 106, and a sensor 107, among others. The processor 101 may include one or more interfaces for interfacing with other components of the wireless headset.
The memory 105 may be used to store program code, such as application program code for pairing and connecting a wireless headset to an electronic device, handling audio traffic of the electronic device (e.g., music playing, answering/making phone calls), etc. The memory 105 may also be used to store other information, such as identity information, connection time, disconnection cause, etc.
In an embodiment of the present application, the at least one memory 105 includes a memory and a flash memory, wherein the memory may be a read-only memory (ROM) or a random access memory (random access memory, RAM), and the information stored in the memory is lost when the wireless headset is powered down. The flash memory may be a flash electrically erasable read-only memory (EEPROM), and the information stored in the flash memory remains after the wireless headset is powered down.
The processor 101 may be configured to execute the above program code and invoke the relevant modules to implement the functions of the wireless headset in the embodiment of the present application. For example, the functions of pairing, connecting, audio playing, receiving/calling and the like between the wireless earphone and the electronic device are realized.
The processor 101 may include one or more processing units, and the different processing units may be separate devices or may be integrated into one or more processors 101. The processor 101 may be in particular an integrated control chip or may be composed of a circuit comprising various active and/or passive components and configured to perform the functions described as belonging to the processor 101 according to an embodiment of the application.
In some embodiments, bluetooth module 102 may be a bluetooth chip. The wireless earphone can be matched and connected with the Bluetooth chip of the electronic equipment through the Bluetooth chip, so that wireless communication and service processing between the wireless earphone and the electronic equipment are realized through Bluetooth connection. In general, bluetooth chips may support Basic Rate (BR)/enhanced data rate (enhanced data rate, EDR) bluetooth and bluetooth low energy (bluetooth low energy, BLE), such as receiving/transmitting paging (page) information, receiving/transmitting BLE broadcasts, and the like. The bluetooth module 102 may receive a signal to be transmitted from the processor 101, perform frequency modulation, amplify the signal, and convert the signal into electromagnetic waves to radiate the electromagnetic waves through a bluetooth antenna.
The audio module 103 may be used to manage audio data, enabling wireless headphones to input and output audio signals. For example, the audio module 103 may obtain an audio signal from the bluetooth module 102, and perform functions of making a call through a wireless headset, playing music, starting/closing a voice assistant of an electronic device connected to the wireless headset, receiving/transmitting voice data of a user, and the like. The audio module 103 may include a speaker (or earpiece, receiver) assembly for outputting audio signals, a microphone (or earpiece, receiver), microphone radio circuitry associated with the microphone, and the like. Speakers may be used to convert audio electrical signals into sound signals and play them. Microphones may be used to convert sound signals into audio electrical signals.
The power module 104 may be used to provide a system power for the wireless earphone, power each module of the wireless earphone, support the wireless earphone to receive charging input, and so on. The power module 104 may include a power management unit (power management unit, PMU) and a battery. The power management unit may receive an external charging input, transform an electrical signal input by the charging circuit, and provide the electrical signal to the battery for charging, transform an electrical signal provided by the battery, and provide the electrical signal to other modules such as the audio module 103 and the bluetooth module 102, and prevent the battery from overcharging, overdischarging, short-circuiting, or overcurrent. In some embodiments, the power module 104 may also include a wireless charging coil for wirelessly charging the wireless headset. In addition, the power management unit can also be used for monitoring parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance) and the like.
A plurality of input/output interfaces 106 may be used to provide a wired connection for charging or communicating with a wireless headset. For example, the input/output interface 106 may be a universal serial bus (universal serial bus, USB) interface, a charging interface, or the like.
In addition, the wireless headset may also include a sensor 107. For example, the sensor 107 may include a temperature sensor 1071, an ambient light sensor 1072, a distance sensor 1073, and a bone conduction sensor 1074.
Illustratively, the wireless headset may utilize a distance sensor 1073 to detect whether an object is in the vicinity of the wireless headset, an ambient light sensor 1072 for sensing ambient light level, and a temperature sensor 1071 for sensing temperature. The processor 101 determines that the wireless headset is in a state of being worn by the user when it is recognized that there is an object in the vicinity of the wireless headset and that the ambient light level is below a preset brightness threshold and the temperature is within a preset interval range (i.e., a body temperature interval of a human body).
As another example, the sensor may also include a bone conduction sensor 1074, in combination with an osteogenic conductive headset. By using the bone conduction sensor 1074, the wireless earphone can acquire the vibration signal of the human body vocal part vibration bone block, analyze the voice signal and realize the voice function, thereby receiving the voice instruction of the user. The wireless earphone can also perform voice authentication according to the user voice signal obtained by the bone conduction earphone so as to authenticate the user identity in business scenes such as payment transaction and the like.
It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the wireless headset. It may have more or fewer components, may combine two or more components, or may have a different configuration of components. For example, the outer surface of the wireless earphone may further include a button, an indicator light (which may indicate a state of an electric quantity, an incoming/outgoing call, a pairing mode, etc.), a display screen (which may prompt a user about information), a dust screen (which may be used with the earphone), etc. The key may be a physical key or a touch key (used in cooperation with a touch sensor), and is used for triggering operations such as starting, shutting down, pausing, playing, recording, starting pairing, resetting, and the like.
The wireless headset described in embodiments of the present application may include a TWS headset.
Fig. 2 is a schematic flow chart of a log storage method 200 according to an embodiment of the present application. The steps of method 200 may be performed by a wireless headset or may be performed by a component in a wireless headset, such as a chip, a system-on-chip, or a processor. The wireless earphone may have a structure as shown in fig. 1, but the embodiment of the present application is not limited thereto. The method 200 includes the steps of:
S201, determining a first output quantity and a second output quantity of logs in the wireless earphone from the memory to the flash memory;
s202, determining whether to continue outputting logs to the flash memory according to the first output quantity and the second output quantity.
The first output number is the output number in a first period taking the first moment as the end moment, and the second output number is the output number in a second period taking the first moment as the end moment, and the time length of the second period is longer than that of the first period.
Illustratively, assuming that the current system time is the tth second, the first period includes a period from the tth second to the tth second, and the second period includes a period included in the last minute of the tth second, the duration of the first period is one second, and the duration of the second period is less than or equal to one minute but greater than one second. The wireless earphone counts the output number of the log in the t second after starting the log record in the t second, and counts the output number of the log in the last minute of the t second. Wherein the period included in the last minute of the tth second includes the period included in the previous minute closest to the period in which the tth second is located, and the specific period included in the last minute of the tth second can be seen from the following description with respect to fig. 3.
In the embodiment of the application, the wireless earphone comprehensively considers the output quantity of the logs from two dimensions of short time and long time, is favorable for accurately controlling the log stream, and inhibits the condition of massive writing of the logs in short time and the condition of controlling frequently executed tasks to output the logs, thereby avoiding the condition of log loss caused by insufficient flash memory space.
In the embodiment of the application, the first output number of the log is the output number in a short time, which may be called short-time output frequency, and the second output number of the log is the output number in a long time, which may be called long-time output frequency.
The short time may include one second, two seconds, three seconds, and the like, and the long time may include one minute, two minutes, three minutes, and the like.
As an alternative embodiment, S202 includes: if the first output number is smaller than the fourth preset threshold value and the second output number is smaller than the fifth preset threshold value, the fact that the log is continuously output to the flash memory is determined. Or if the first output number is greater than or equal to the fourth preset threshold value, and/or if the second output number is greater than or equal to the fifth preset threshold value, determining to limit the continuous output of the log to the flash memory.
In the embodiment of the application, the wireless earphone sets a fourth preset threshold and a fifth preset threshold for the log, wherein the fourth preset threshold is a short-time output threshold for limiting the output of the log in a short time, and the fifth preset threshold is a long-time output threshold for limiting the output of the log in a long time.
In general, wireless headsets may perform a variety of tasks, such as a task of establishing a bluetooth connection, an audio task, a talk task, a stress test task, and so forth. It can be understood that the wireless earphone may not distinguish output thresholds of various tasks, and outputs of logs of all tasks are controlled according to the fourth preset threshold and the fifth preset threshold.
However, different traffic scenarios may require attention to different output thresholds, so that the output of the log may be carefully managed for different tasks.
As an alternative embodiment, the log includes a log corresponding to each of the at least one task, and S201 includes: a first output number and a second output number of a log of a first task in the wireless headset from the memory to the flash memory are determined, the first task being any one of the at least one task.
According to the embodiment of the application, the output quantity of the logs is controlled by taking the task as the dimension, the first output quantity and the second output quantity of the logs of each task are controlled, and the storage space is divided for the modules of each task. The first task is one of at least one task of a wireless headset, which may determine a first output quantity and a second output quantity of the first task to control log output of the first task.
According to the embodiment of the application, the wireless earphone maintains three structural bodies, namely g_LogFreqStaticInfo, g_LogMomentFreqInfo and g_LogFreqInfo, for each task module. The method comprises the steps that a name of a task and a corresponding log output threshold value are recorded by g_LogFreqStaticInfo, a developer can maintain the log output threshold value of the task in a structure body, the log output threshold value comprises a first preset threshold value and a second preset threshold value, the first preset threshold value is a short-time output threshold value of the log, and the second preset threshold value is a long-time output threshold value of the log. The g_logmomentfreqinfo records a first output number of the log and the g_logfreqinfo records a second output number of the log.
Examples of g_logfreqstaticinfo structures are as follows:
where name represents the name of the task and limitFreq represents the log output threshold.
In the embodiment of the application, for each task, a developer needs to evaluate the output quantity of the log output of the task from the memory to the flash memory, integrate the magnitudes of all tasks and the current log quantity, and set a short-time output threshold and a long-time output threshold for each task, that is, the first preset threshold of different tasks may be different, and/or the second preset threshold of different tasks may be different.
When the module of each task is initialized, a developer binds the name of the task with the Identity (ID) of the task, and the structure g_log freqstaticinfo indicates that the name of the task and the log output threshold have a binding relationship, so that the name of the task and the log output threshold can be bound by binding the name of the task with the identity of the task and binding the name of the task and the log output threshold. When a developer maintains and tests the wireless earphone, the corresponding log output threshold value can be directly modified through the task name; when the wireless earphone is put into use, the module of each task can acquire a corresponding log output threshold value according to the identification of the task so as to carry out log stream control.
According to the scheme, the log flow control mechanism of each task comprises a short-time flow control mechanism and a long-time flow control mechanism, wherein the short-time flow control mechanism is used for inhibiting the condition that a large amount of logs are written in a short time when the tasks occur, and the long-time flow control mechanism is used for controlling the log output of the frequently executed tasks. A specific implementation of the log storage method according to an embodiment of the present application is described below with reference to fig. 3.
Fig. 3 is a schematic flow chart of another log storage method 300 provided by an embodiment of the present application, and the steps of the method 300 may be performed by a wireless headset or may be performed by a component in the wireless headset, such as a chip, a system-on-chip, or a processor. The wireless earphone may have a structure as shown in fig. 1, but the embodiment of the present application is not limited thereto. The method 300 includes S301 to S308, which specifically include the following steps:
S301, starting log record for a first task.
For example, the wireless headset may initiate logging for the first task if it is determined to perform the first task. Taking a task as a Bluetooth connection as an example, the wireless earphone detects a Bluetooth connection request from other devices, and starts log recording for the Bluetooth connection under the condition that the Bluetooth connection is determined to be executed.
For example, the wireless earphone may periodically start logging, and when logging is started, if the current execution task is detected to be the first task, the logging for the first task is started, and log output of the first task is controlled.
In the embodiment of the present application, the log record refers to recording the output number of the log in a short time and the output number in a long time.
S302, determining a first output number and a second output number of the logs of the first task.
The following description will take, as an example, the first output number as the output number in one second with the first time as the end time, and the second output number as the output number in the last one minute with the first time as the end time.
Illustratively, the current second is a t-th second, the wireless headset starts logging for the first task at the t-th second, records an output number of the log of the first task at the t-th second, and outputs a number of the log of the first task at a last minute of the t-th second.
The output number of the log of the first task at the t second can be determined by the structure g_logmomentfreqinfo, and the structure of g_logmomentfreqinfo is exemplified as follows:
where startTick represents the start time of starting the logging, currentNum represents the output number of logs of the first task counted from the start time.
Illustratively, startTick takes a value of 10 and currentNum takes a value of 5 at 10 seconds. When the current system time is 11 th second, the wireless earphone determines that one second passes from the start of log recording, and the value of the current currentNum is 15, and the output number of the logs of the first task in the second from 10 th second to 10 th second is 10.
In the present example, the first time described above is the time at which the 10 th second ends, that is, the time at which the 11 th second starts.
The output number of the log of the first task in the last minute of the t second can be determined by the structure g_logfreqinfo, and the structure of the g_logfreqinfo is exemplified as follows:
the LogFreqInfobuffer is a storage space of the first task and is used for recording the output number of the log of the first task in the last minute of the current system time. The memory space uses freqInfo 6 array for data storage, including 6 subspaces. The six subspaces are respectively identified as "0", "1", "2", "3", "4", "5", and each subspace stores the output number of the log of the first task in a preset time period, and the duration of the preset time period is 10 seconds. limitFreq represents a log output threshold for the first task.
The structure of the LogFreqInfobuffer is exemplified as follows:
wherein, the tick indicates the sign of the preset time period, and the value of the tick can be determined by the current system time/10, and each value corresponds to one subspace of 6 subspaces. num represents the number of outputs of the log stored in the subspace corresponding to the value of the tick within the period identified by the value of the tick.
And, on the other hand, a value of 0 is used for identifying a period from 0 th second to 9 th second, a value of 1 is used for identifying a period from 10 th second to 19 th second, a value of 2 is used for identifying a period from 20 th second to 29 th second, and so on, a value of 7 is used for identifying a period from 70 th second to 79 th second, and a value of 10 is used for identifying a period from 100 th second to 109 th second.
In the embodiment of the application, the wireless earphone adopts the freqInfo 6 array to count the output quantity of the log of the first task in the last minute of the current system time. In one implementation, the value of the tick may be determined by rounding the value obtained for the current system time/10.
Illustratively, t=3, which indicates that the current system time is 3 rd second, and tick=0 is determined by rounding the value obtained by the current system time/10, that is, the period in which 3 rd second is located is the period in which tick is identified as 0.
Illustratively, t=10, which indicates that the current system time is 10 th seconds, and tick=1 is determined by rounding the value obtained by the current system time/10, that is, the period in which the 10 th seconds are located is the period in which the tick is 1.
Illustratively, t=73, which indicates that the current system time is 73 th second, and tick=7 is determined by rounding the value obtained by the current system time/10, that is, the period in which 73 th second is located is the period in which tick is 7.
Similarly, t=101, which indicates that the current system time is 101 th second, and the period in which 101 th second is located is the period identified by the tick being 10.
The process of determining the output number of the log of the first task in the last minute of the t-th second is illustrated below in conjunction with fig. 4.
Fig. 4 is a schematic diagram of an output number of statistics logs in the last minute according to an embodiment of the present application. As shown in a of fig. 4, a first subspace denoted as "0", a second subspace denoted as "1", a third subspace denoted as "2", a fourth subspace denoted as "3", a fifth subspace denoted as "4", and a sixth subspace denoted as "5" are sequentially arranged from left to right.
When initializing the freqInfo [6] array, the first subspace is used for recording the output quantity of the first task log in the period marked by the time block being 0, the second subspace is used for recording the output quantity of the first task log in the period marked by the time block being 1, the third subspace is used for recording the output quantity of the first task log in the period marked by the time block being 2, the fourth subspace is used for recording the output quantity of the first task log in the period marked by the time block being 3, the fifth subspace is used for recording the output quantity of the first task log in the period marked by the time block being 4, and the sixth subspace is used for recording the output quantity of the first task log in the period marked by the time block being 5. In the initialization stage, the output number of the log of the first task recorded in each subspace in the corresponding time period is 0.
The following description will take the example that the wireless headset starts the log recording for the first task at the 2 nd second, the 3 rd second, the 10 th second, the 73 rd second and the 101 th second in order.
Referring to B in fig. 4, if logging is started for the first task when the current system time is 2 nd second, tick=0 is determined by rounding the value obtained by the current system time/10, and tick is 0 for identifying a period from 0 th second to 9 th second, and the output number of the log of the first task in this period is recorded in the first subspace.
Illustratively, at the end of the current system time, the output number of the log recorded in the first subspace in the period from the 0 th second to the 9 th second end is 1 (the first subspace actually records the output number from the 0 th second to the 2 nd second end at the 2 nd second end), and thus, the last one minute output number of the log of the first task at the 2 nd second is the number of the log of the first task recorded in the first subspace at the end of the current system time.
It will be appreciated that in this example, the last minute of 2 nd second includes the period from 0 th second to 2 nd second, i.e. the second period described above includes the period from 0 th second to 2 nd second. The first moment described above, i.e. the moment when the 2 nd second ends.
Referring to C in fig. 4, if log recording for the first task is started when the current system time is 3 rd second, tick=0 is determined by rounding the value obtained by the current system time/10, and tick is 0 for identifying the period from 0 th second to 9 th second and the output number of the log of the first task in this period is recorded in the first subspace.
Illustratively, at the end of the current system time, the output number of the log recorded in the first subspace in the period from the 0 th second to the 9 th second end is 2 (the first subspace actually records the output number from the 0 th second to the 3 rd second end at the 3 rd second end), and thus, the last one minute output number of the log of the first task at the 3 rd second is the number of the log of the first task recorded in the first subspace at the end of the current system time.
It will be appreciated that in this example, the last minute of the 3 rd second includes the period from the 0 th second to the 3 rd second, i.e., the second period described above includes the period from the 0 th second to the 3 rd second.
Referring to D in fig. 4, if log recording for the first task is started when the current system time is 10 th seconds, tick=1 is determined by rounding the value obtained by the current system time/10, and tick is 1 for identifying the period from 10 th seconds to 19 th seconds, and the output number of the log of the first task in this period is recorded in the second subspace.
Illustratively, at the end of the current system time, the output number of the log recorded in the first subspace in the period from the 0 th second to the 9 th second is 2, and the output number of the log recorded in the period from the 10 th second to the 19 th second is 1 (the second subspace actually records the output number from the 10 th second to the 10 th second at the 10 th second end), and thus, the output number of the log of the first task in the last minute of the 3 rd second includes the sum of the number of the log of the first task recorded in the first subspace and the number of the log recorded in the second subspace at the end of the current system time.
It is to be understood that in the present example, the second period described above includes a period from the 0 th second to the 9 th second and a period from the 10 th second to the 10 th second.
Referring to E in fig. 4, if logging is started for the first task when the current system time is 73 th second, tick=7 is determined by rounding the value obtained by the current system time/10, and tick is 7 for identifying the period from the start of 70 th second to the end of 79 th second.
If the current system time is 73 seconds, tick=7, and the first to sixth subspaces are used for recording the output number of the log of the first task from 0 to 59 minutes during initialization. When the current system time exceeds 59 seconds, the wireless earphone can redetermine the corresponding relation between the preset time period and the subspace.
In one possible implementation, the wireless headset determines the identity of the subspace to which the tick corresponds by a value obtained by (tick% 60)/10. Where,% represents the remainder of the division of tick by 60, and tick 60 represents the remainder of the division of tick by 60. When tick=7, the value calculated by (tick% 60)/10 is 1, i.e., the output number of the log of the first task in the period identified by tick 7 is recorded in the second subspace identified as "1". It should be appreciated that the number of outputs previously recorded in the second subspace during the period identified by a tick of 1 may be covered.
Illustratively, when the current system time is 73 th second, the first subspace records the output number of the log of the first task in the period from 0 th second to 9 th second, the second subspace records the output number of the log of the first task in the period from 70 th second to 79 th second, the third subspace records the output number of the log of the first task in the period from 20 th second to 29 th second, the fourth subspace records the output number of the log of the first task in the period from 30 th second to 39 th second, the fifth subspace records the output number of the log of the first task in the period from 40 th second to 49 th second, the sixth subspace records the output number of the log of the first task in the period from 50 th second to 59 th second, the period from 50 th second to 5 th second.
It will be appreciated that the number of outputs recorded in the first subspace is not within the last minute of 73 seconds from the beginning of 0 seconds to the end of 9 seconds, so the wireless headset only has to calculate the sum of the number of outputs recorded in the second subspace, the number of outputs recorded in the third subspace, the number of outputs recorded in the fourth subspace, the number of outputs recorded in the fifth subspace, and the number of outputs recorded in the sixth subspace when counting the number of outputs of the last minute of 73 seconds.
In one possible implementation, it may be determined whether the preset time period corresponding to a certain subspace is within the last minute of the current system time by comparing whether the difference between the value of the tick of the current system time and the value of the tick corresponding to other subspaces is within 6.
Referring to E in fig. 4, the value of the tick of the current system time is 7, and the value of the tick corresponding to the first subspace is 0, and the difference between 7 and 0 is not within 6; the difference value of the tick values 2,7 and 2 corresponding to the third subspace is within 6; the value of the tick corresponding to the fourth subspace is 3, and the difference value between 7 and 3 is within 6; the difference value of the tick values 4,7 and 4 corresponding to the fifth subspace is within 6; the difference value of the corresponding tick value of the sixth subspace of 5,7 and 5 is within 6. Thus, the last minute of output of the log of the first task at 73 seconds includes the sum of the output of the log of the first task recorded in the second subspace, the output of the log of the third task recorded in the third subspace, the output of the log of the fourth task recorded in the fourth subspace, the output of the log of the fifth task recorded in the fifth subspace, and the output of the log of the sixth task recorded in the sixth subspace.
It is to be understood that in the present example, the second period described above includes a period from 20 th to 29 th seconds, a period from 30 th to 39 th seconds, a period from 40 th to 49 th seconds, a period from 50 th to 59 th seconds, and a period from 70 th to 79 th seconds.
Referring to F in fig. 4, if log recording for the first task is started when the current system time is 101 th second, tick=10 is determined by rounding the value obtained by the current system time/10, and tick is 10 for identifying the period from 100 th second to 109 th second.
Similar to the description for 73 th second, the process of specifically determining the output number of the log of the first task at the last one minute of 101 th second is not described here again. The last minute of output of the log of the first task at the 101 th second includes the sum of the output of the log of the first task recorded in the second subspace, the output of the log of the fifth task recorded in the fifth subspace, and the output of the log of the sixth task recorded in the sixth subspace.
It is to be understood that in the present example, the second period described above includes a period from 50 th to 59 th, a period from 70 th to 79 th, and a period from 100 th to 109 th.
S303, determining a first preset threshold value and a second preset threshold value of the first task.
From the above description, it is clear that the first preset threshold and the second preset threshold of the first task can be obtained by the structure g_logfreqstaticinfo.
S304, determining whether to continue outputting the log to the flash memory according to the first output number, the second output number, the first preset threshold and the second preset threshold of the first task.
If the first output number is smaller than the first preset threshold and the second output number is smaller than the second preset threshold, S305 is executed; if the first output number is greater than or equal to the first preset threshold, and/or the second output number is greater than or equal to the second preset threshold, S306 is executed.
S305, determining to continue outputting the log to the flash memory.
When the first output number and the second output number of the logs of the first task are both larger than the preset threshold, the condition that the first task is not subjected to mass writing in a short time can be determined, the logs are in a more gentle and stable output state, and the logs can be continuously output to the flash memory.
S306, determining to limit the continuous output of the log to the flash memory.
When any one of the first output number and/or the second output number of the log of the first task exceeds the preset threshold, it may be determined that the first task may possibly have a large amount of log brushed in a short time, so the wireless headset may limit the log of the first task to continue outputting the log to the flash memory.
When it is determined that the output of the log of the first task to the flash memory is restricted, the wireless headset sets a log record enable switch of the first task to "false", while recording the number of times the first task is restricted from being output.
S307, determining a third output number and a fourth output number of the log of the first task.
The third output number is the output number of the log of the first task in a third period from the memory to the flash memory by taking the second moment as the end moment, the fourth output number is the output number of the log of the first task in a fourth period from the memory to the flash memory by taking the second moment as the end moment, the duration of the fourth period is longer than that of the third period, and the second moment is after the first moment.
Similarly to the description for S302, the description will be given taking as an example that the third output number is the output number within one second with the second time as the end time, and the fourth output number is the output number of the last minute with the second time as the end time.
Illustratively, the wireless headset starts logging for the first task once at 10 seconds, and then starts logging for the first task again at 20 seconds, then the second time is 20 seconds, the third output number is the output number of the logs of the first task in 20 seconds, that is, from 20 seconds to 20 seconds, and the fourth output number is the output number of the last minute (including 20 seconds) of 20 seconds at 20 seconds to 20 seconds.
The specific manner of determining the third output number and the fourth output number may refer to the description of S302, and will not be described herein.
S308, determining whether to resume the log output to the flash memory according to the third output number, the fourth output number, the first preset threshold and the second preset threshold of the first task.
If the third output number is smaller than the first preset threshold, and the fourth output number is smaller than the third preset threshold, it is determined that the log is restored to be continuously output to the flash memory, and S305 is executed. Or, if the third output number is greater than or equal to the first preset threshold, and/or the fourth output number is greater than or equal to the third preset threshold, S306 is executed.
Illustratively, the third preset threshold may be seven-eighth of the second preset threshold, but embodiments of the present application are not limited thereto. For example, the third preset threshold may also be equal to the second preset threshold.
Upon determining to resume outputting the log of the first task to the flash memory, the wireless headset resets the log enable switch of the first task to true. Printing the starting time of the limited times of the first task while resetting the enabling switch so that the development task can know the output condition of the log of the first task based on the printed information, and accordingly adjusting the log output threshold of the first task.
At present, on TWS headphones, different log output thresholds need to be paid attention to for different service scenes. According to the embodiment of the application, the character is used as the dimension to carry out log stream control, a developer can search a corresponding log output threshold value according to the identification of a task under a log_stream_control.c file according to the service condition, modify a g_LogFreqStaticInfo variable, and achieve the expected maintenance effect and test effect by adjusting a short-time output threshold value and a long-time output threshold value.
For example, in a task scenario where bluetooth connection is a short time and there are many service steps, the output number of logs in a short time is large. For the service, a developer can raise the short-time output threshold value, so that the developer can output more logs meeting the positioning condition in a short time. However, the output threshold value needs to be strictly limited for a long time, so that the phenomenon that the log space is insufficient due to frequent execution of the service is prevented, and the frequent execution behavior of the service with the system occupancy rate can be limited.
For example, for a service frequently executed for a long time such as audio, the number of outputs of the log thereof in a short time is small, but the execution frequency is high. For the service, developers can make strict limits on a short-time output threshold, and the problem that a large number of logs are frequently printed to cause insufficient log space is avoided.
For example, in the scenario of stress testing on a product, a developer may increase the log output threshold of a stress test specific related task, and decrease the log output threshold of other unrelated tasks to limit the output of the log of other unrelated tasks. The effect of adjusting log space allocation is achieved by adjusting the log output threshold of the blind task.
The above-described log space can be understood as a space for storing logs in the flash memory.
It should be understood that the sequence numbers of the above processes do not mean the order of execution, and the execution order of the processes should be determined by the functions and internal logic of the processes, and should not be construed as limiting the implementation process of the embodiments of the present application.
The log storage method according to the embodiment of the present application is described in detail above with reference to fig. 2 to 4, and the log storage device according to the embodiment of the present application will be described in detail below with reference to fig. 5.
Fig. 5 is a schematic block diagram of a storage device 500 according to an embodiment of the present application. The apparatus 500 includes an output module 510 and a processing module 520.
Wherein, output module 510 is used for: outputting the log in the wireless earphone from the memory to the flash memory; the processing module 520 is configured to: determining a first output number and a second output number of logs in the wireless earphone from the memory to the flash memory; and determining whether to continue outputting logs to the flash memory according to the first output number and the second output number. The first output number is the output number in a first period taking the first moment as the end moment, and the second output number is the output number in a second period taking the first moment as the end moment, and the time length of the second period is longer than that of the first period.
Optionally, the log includes a log corresponding to each of the at least one task. The processing module 520 is configured to: a first output number and a second output number of a log of a first task in the wireless headset from the memory to the flash memory are determined, the first task being any one of the at least one task.
Optionally, the processing module 520 is configured to: determining a first preset threshold value and a second preset threshold value of a first task; and determining whether to continue outputting the log to the flash memory according to the first output number, the second output number, the first preset threshold value and the second preset threshold value.
Optionally, the processing module 520 is configured to: if the first output number is smaller than a first preset threshold value and the second output number is smaller than a second preset threshold value, determining to continue outputting logs to the flash memory; or if the first output number is greater than or equal to the first preset threshold value, and/or if the second output number is greater than or equal to the second preset threshold value, determining to limit the continuous output of the log to the flash memory.
Optionally, the processing module 520 is configured to: determining a third output number and a fourth output number of logs in the wireless earphone from the memory to the flash memory; and determining whether to resume the log output to the flash memory according to the third output number, the fourth output number, the first preset threshold value and the second preset threshold value. Wherein the third output number is the output number in a third period taking the second time as the end time, and the fourth output number is the output number in a fourth period taking the second time as the end time; the fourth period of time is longer than the third period of time, and the second time is after the first time.
Optionally, the processing module 520 is configured to: determining a third preset threshold according to the second preset threshold; if the third output number is smaller than the first preset threshold value and the fourth output number is smaller than the third preset threshold value, determining to resume outputting the log to the flash memory. Or if the third output number is greater than or equal to the first preset threshold value, and/or the fourth output number is greater than or equal to the third preset threshold value, determining to limit the continuous output of the log to the flash memory.
Optionally, the at least one task further includes a second task, where a first preset threshold of the second task is different from a first preset threshold of the first task, and/or a second preset threshold of the second task is different from a second preset threshold of the first task.
In an alternative example, one skilled in the art will appreciate that the apparatus 500 may be embodied as a wireless headset, or that the functionality of the wireless headset may be integrated in the apparatus 500. The above functions may be implemented by hardware, or may be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the functions described above.
It should be appreciated that the apparatus 500 herein is embodied in the form of functional modules. The term module herein may refer to an application specific integrated circuit (application specific integrated circuit, ASIC), an electronic circuit, a processor (e.g., a shared, dedicated, or group processor, etc.) and memory that execute one or more software or firmware programs, a combinational logic circuit, and/or other suitable components that support the described functionality. In an embodiment of the present application, the apparatus 500 may also be a chip or a chip system, for example: system on chip (SoC).
The apparatus of this embodiment may be correspondingly configured to perform the steps performed in the foregoing method embodiments, and the implementation principle and technical effects are similar, which are not described herein again.
The application also provides a computer readable storage medium, wherein computer executable instructions are stored in the computer readable storage medium, and when the computer executable instructions are executed by a processor, the method executed by the wireless earphone in any method embodiment can be realized.
Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the method performed by the wireless headset of any of the method embodiments described above.
In the above embodiments, the instructions stored by the memory for execution by the processor may be implemented in the form of a computer program product. The computer program product may be written in the memory in advance, or may be downloaded in the form of software and installed in the memory.
The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL), or wireless (e.g., infrared, wireless, microwave, etc.), or semiconductor medium (e.g., solid state disk, SSD)) or the like.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system, apparatus and module may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. 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 each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a specific implementation of the present application, but the scope of the embodiments of the present application is not limited thereto, and any person skilled in the art may easily think about changes or substitutions within the technical scope of the embodiments of the present application, and all changes and substitutions are included in the scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. A log storage method, comprising:
determining a first output number and a second output number of logs in the wireless earphone from the memory to the flash memory; the first output number is the output number in a first period taking a first moment as an end moment, and the second output number is the output number in a second period taking the first moment as the end moment; the duration of the second period is longer than the duration of the first period;
and determining whether to continue outputting logs to the flash memory according to the first output number and the second output number.
2. The method of claim 1, wherein the log comprises a log corresponding to each of the at least one task, and wherein determining the first and second output numbers of the log in the wireless headset from the memory output to the flash memory comprises:
Determining the first output number and the second output number of a log of a first task in the wireless headset from the memory to the flash memory, wherein the first task is any one of the at least one task.
3. The method according to claim 2, wherein the method further comprises:
determining a first preset threshold value and a second preset threshold value of the first task;
the determining whether to continue outputting logs to the flash memory according to the first output number and the second output number includes:
and determining whether to continue outputting logs to the flash memory according to the first output number, the second output number, the first preset threshold and the second preset threshold.
4. The method of claim 3, wherein the determining whether to continue outputting logs to the flash memory based on the first output number, the second output number, the first preset threshold, and the second preset threshold comprises:
if the first output number is smaller than the first preset threshold value and the second output number is smaller than the second preset threshold value, determining to continue outputting logs to the flash memory; or (b)
And if the first output number is greater than or equal to the first preset threshold value, and/or the second output number is greater than or equal to the second preset threshold value, determining to limit the continuous output of the log to the flash memory.
5. The method of claim 4, wherein after the determining limits continuing to output logs to the flash memory, the method further comprises:
determining a third output number and a fourth output number of the logs in the wireless earphone from the memory to the flash memory; the third output number is the output number in a third period taking the second moment as the end moment, and the fourth output number is the output number in a fourth period taking the second moment as the end moment; the duration of the fourth period is longer than the duration of the third period; the second time is after the first time;
and determining whether to resume the log output to the flash memory according to the third output number, the fourth output number, the first preset threshold and the second preset threshold.
6. The method of claim 5, wherein the determining whether to resume outputting the log to the flash memory based on the third output number, the fourth output number, the first preset threshold, and the second preset threshold comprises:
Determining a third preset threshold according to the second preset threshold; a kind of electronic device with high-pressure air-conditioning system
If the third output number is smaller than the first preset threshold value, and the fourth output number is smaller than the third preset threshold value, determining to resume outputting logs to the flash memory continuously; or (b)
And if the third output number is greater than or equal to the first preset threshold value, and/or the fourth output number is greater than or equal to the third preset threshold value, determining to limit the continuous output of the log to the flash memory.
7. Method according to any of the claims 2 to 6, characterized in that a second task is further comprised in the at least one task, a first preset threshold value of the second task being different from a first preset threshold value of the first task and/or a second preset threshold value of the second task being different from a second preset threshold value of the first task.
8. A log storage device comprising means for performing the method of any one of claims 1 to 7.
9. A log storage device, comprising: a processor and a memory, wherein,
the memory is used for storing a computer program;
the processor is configured to invoke and execute the computer program to cause the apparatus to perform the method of any of claims 1 to 7.
10. A computer readable storage medium for storing a computer program which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 7.
11. A computer program product comprising computer program code embodied therein, which when run on a computer causes the computer to carry out the method according to any one of claims 1 to 7.
CN202211066944.XA 2022-09-01 2022-09-01 Log storage method and related device Active CN116744168B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211066944.XA CN116744168B (en) 2022-09-01 2022-09-01 Log storage method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211066944.XA CN116744168B (en) 2022-09-01 2022-09-01 Log storage method and related device

Publications (2)

Publication Number Publication Date
CN116744168A true CN116744168A (en) 2023-09-12
CN116744168B CN116744168B (en) 2024-05-14

Family

ID=87903192

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211066944.XA Active CN116744168B (en) 2022-09-01 2022-09-01 Log storage method and related device

Country Status (1)

Country Link
CN (1) CN116744168B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011065513A (en) * 2009-09-18 2011-03-31 Victor Co Of Japan Ltd Device and method for storing operation history information
US20140149924A1 (en) * 2012-11-29 2014-05-29 International Business Machines Corporation Logged event frequency visualization
JP2018045387A (en) * 2016-09-13 2018-03-22 東芝メモリ株式会社 Memory system
CN108924683A (en) * 2018-06-06 2018-11-30 歌尔科技有限公司 A kind of daily record data store method, device and TWS earphone
CN109918399A (en) * 2018-08-13 2019-06-21 新华三大数据技术有限公司 Method for writing data and device
US20190384756A1 (en) * 2018-06-15 2019-12-19 EMC IP Holding Company LLC Method, device and computer program product for managing log
WO2021184996A1 (en) * 2020-03-20 2021-09-23 华为技术有限公司 Data storage method and apparatus for database
US20220035548A1 (en) * 2020-07-31 2022-02-03 EMC IP Holding Company LLC Data storage method, electronic device, and computer program product
CN114201551A (en) * 2021-12-07 2022-03-18 建信金融科技有限责任公司 Data storage method and data storage device
CN114879900A (en) * 2021-02-05 2022-08-09 华为技术有限公司 Log file processing method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011065513A (en) * 2009-09-18 2011-03-31 Victor Co Of Japan Ltd Device and method for storing operation history information
US20140149924A1 (en) * 2012-11-29 2014-05-29 International Business Machines Corporation Logged event frequency visualization
JP2018045387A (en) * 2016-09-13 2018-03-22 東芝メモリ株式会社 Memory system
CN108924683A (en) * 2018-06-06 2018-11-30 歌尔科技有限公司 A kind of daily record data store method, device and TWS earphone
US20190384756A1 (en) * 2018-06-15 2019-12-19 EMC IP Holding Company LLC Method, device and computer program product for managing log
CN109918399A (en) * 2018-08-13 2019-06-21 新华三大数据技术有限公司 Method for writing data and device
WO2021184996A1 (en) * 2020-03-20 2021-09-23 华为技术有限公司 Data storage method and apparatus for database
US20220035548A1 (en) * 2020-07-31 2022-02-03 EMC IP Holding Company LLC Data storage method, electronic device, and computer program product
CN114879900A (en) * 2021-02-05 2022-08-09 华为技术有限公司 Log file processing method and device
CN114201551A (en) * 2021-12-07 2022-03-18 建信金融科技有限责任公司 Data storage method and data storage device

Also Published As

Publication number Publication date
CN116744168B (en) 2024-05-14

Similar Documents

Publication Publication Date Title
WO2021042942A1 (en) Wireless earphones and wireless earphone system
CN110602678B (en) Wireless audio output device
CN1826001B (en) Multimode transmission control method and multimode transmission control apparatus
US9697725B2 (en) Apparatus and method for providing battery information, and user terminal therefor
CN114915957B (en) Bluetooth headset reconnection control method and control device
US9239772B2 (en) Detecting true battery removal from a host device by comparing a voltage level on a communication line with a threshold voltage level
CN105653323A (en) Application program management method and device
CN109151697B (en) Microphone hole blockage detection method and related product
KR20200117203A (en) Method for transmitting sounding reference signals and electronic device thereof
CN106453791A (en) A sound signal output method and apparatus and an earphone state detection method and apparatus
US11425520B2 (en) Method for detecting blocking of microphone and related products
CN112839303A (en) Method and related device for device reconnection
CN111417219A (en) Network release method and device
CN108834013B (en) Wearable equipment electric quantity balancing method and related product
CN107707642A (en) Brush amount terminal determines method and device
CN103312597A (en) Voice message generating method and voice message generating device
CN103338193A (en) Method, system and device for initial media equipment
CN111274043B (en) Near field communication method, near field communication device, near field communication system, storage medium and electronic equipment
CN103347093A (en) User data upgrading method, relevant equipment and communication system
CN116744168B (en) Log storage method and related device
CN109040912B (en) Plugging hole treatment method and related product
CN113271194A (en) System and method for providing channel state information reference signal power determination
CN109275070B (en) Early warning prompting method and device for preventing microphone from being damaged and terminal equipment
CN108650595B (en) Hole plugging processing method and device, electronic equipment and computer readable storage medium
CN108605067B (en) Method for playing audio and mobile terminal

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