WO2016101686A1 - 文件扫描方法及终端 - Google Patents

文件扫描方法及终端 Download PDF

Info

Publication number
WO2016101686A1
WO2016101686A1 PCT/CN2015/092211 CN2015092211W WO2016101686A1 WO 2016101686 A1 WO2016101686 A1 WO 2016101686A1 CN 2015092211 W CN2015092211 W CN 2015092211W WO 2016101686 A1 WO2016101686 A1 WO 2016101686A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
scanned
scanning
policy
scan
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.)
Ceased
Application number
PCT/CN2015/092211
Other languages
English (en)
French (fr)
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.)
Shenzhen TCL Digital Technology Co Ltd
Original Assignee
Shenzhen TCL Digital Technology 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 Shenzhen TCL Digital Technology Co Ltd filed Critical Shenzhen TCL Digital Technology Co Ltd
Publication of WO2016101686A1 publication Critical patent/WO2016101686A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of file processing technologies, and in particular, to a file scanning method and a terminal.
  • file classification scanning technology has been implemented on many platforms.
  • the existing file classification scanning software needs to occupy a large amount of CPU and memory resources in the process of file classification scanning, which causes the software system to run slowly, and even causes the system to crash.
  • the main object of the present invention is to provide a file scanning method and a terminal, which aim to dynamically perform file classification scanning without affecting the normal operation of the system, thereby ensuring stability and high performance of the system.
  • the present invention provides a file scanning method, including:
  • the current usage state of the system is determined according to the current CPU usage and the memory usage of the system, and the file to be scanned is scanned according to the current usage state of the system.
  • the step of determining the current usage state of the system according to the current CPU occupancy rate and the memory usage rate of the system, and selecting a corresponding scanning policy to scan the file to be scanned according to the current usage state of the system include:
  • the file to be scanned is scanned by using an idle scanning policy
  • the file to be scanned is scanned by using a stage scanning policy; N ⁇ M.
  • the step of scanning the file to be scanned by using an idle scanning policy includes:
  • the file to be scanned is continuously scanned until the files to be scanned are scanned.
  • the step of scanning the file by using a phase scanning policy comprises:
  • the broadcast message of the scan completion is sent to the system, and the scan data displayed by the interface is refreshed by the system;
  • the system satisfies N ⁇ X + Y ⁇ M At the same time, the scanning of the K files in the unscanned file is continued, and the processing is continued until the files to be scanned are scanned.
  • the method further comprises:
  • the file in the file or folder clicked by the user is preferentially scanned;
  • the step of obtaining a file to be scanned includes:
  • the file to be scanned is obtained locally, and/or the file to be scanned is obtained from an external device.
  • the embodiment of the invention further provides a file scanning terminal, comprising:
  • a file obtaining module configured to acquire a file to be scanned
  • a parameter obtaining module configured to acquire a current CPU occupancy rate and a memory usage rate of the system
  • the scanning module is configured to determine a current usage state of the system according to a current CPU usage and a memory usage of the system, and select a corresponding scanning policy to scan the file to be scanned according to the current usage state of the system.
  • the scanning module is further configured to calculate a sum of a current CPU occupancy rate and a memory usage rate of the system; when a sum of a current CPU occupancy rate and a memory usage rate of the system is less than a first set value N And scanning the file to be scanned by using an idle scanning policy; when the sum of the CPU occupancy rate and the memory usage rate of the system is greater than or equal to the first set value N and less than the second set value M, the adopting phase Scanning a policy to scan the file to be scanned; wherein, N ⁇ M.
  • the scanning module is further configured to: after the idle scanning policy, perform continuous scanning on the file to be scanned until the files to be scanned are scanned; and in the stage scanning policy, for a predetermined number of K The file is scanned; when the scan completes a predetermined number of K files, the broadcast message is completed to the system, and the scan data displayed by the interface is refreshed by the system; the index of the scanned file is recorded by the flag bit; X + Y ⁇ M, continue to scan K of the unscanned files, and continue until the files to be scanned are scanned.
  • the scanning module is further configured to: when receiving a click instruction of a file or a folder by a user, in a process of performing file scanning by the idle scanning policy or the phase scanning policy, preferentially scanning a file clicked by the user or a file in the folder; or a file that has not been scanned for the idle scanning policy and the stage scanning policy, when the user clicks on the file or the folder in which the file is located, the file is scanned or according to a user's clicking operation All files in the folder where the file is located.
  • the file scanning method and the terminal provided by the embodiment of the present invention obtain the current CPU usage and the memory usage rate of the system by obtaining the file to be scanned; and determine the current usage state of the system according to the current CPU occupancy rate and memory usage rate of the system. According to the current usage status of the system, select the corresponding scanning policy to scan the file. Therefore, under the condition that the system software is running normally, the files are classified according to the current usage state (CPU occupancy rate and memory usage rate) of the system. Scanning can not only ensure the stability and high performance of the system, but also meet the needs of users for file classification scanning.
  • FIG. 1 is a schematic flow chart of a preferred embodiment of a document scanning method of the present invention
  • FIG. 2 is a schematic diagram of functional modules of a preferred embodiment of the document scanning terminal of the present invention.
  • the solution of the embodiment of the present invention is: obtaining the file to be scanned; obtaining the CPU occupancy rate and the memory usage rate of the current system; determining the current usage state of the system according to the CPU occupancy rate and the memory usage rate of the system, according to the The usage status selects the corresponding scanning policy to scan the file. Therefore, under the condition that the system software is running normally, the files are classified and scanned according to the current usage state (CPU occupancy rate and memory usage rate) of the system, which can ensure the stability and high performance of the system, and can also meet the needs of users. The need for file classification scanning.
  • a preferred embodiment of the present invention provides a file scanning method, including:
  • Step S101 acquiring a file to be scanned
  • the file to be scanned in this embodiment may be a media file, a text file, or other types of files.
  • the media file is used as an example, and the media file is scanned for other applications.
  • the file to be scanned may be obtained from the local terminal, or the file to be scanned may be obtained from an external device (such as an SD card), and the external device may be connected to the local terminal through the USB data line, or may be Local terminal wireless connection.
  • the local terminal can be a PC or a mobile terminal such as a mobile phone or a tablet.
  • Step S102 obtaining a current CPU occupancy rate and a memory usage rate of the system
  • Step S103 Determine the current usage state of the system according to the current CPU occupancy rate and the memory usage rate of the system, and select a corresponding scanning policy to scan the file to be scanned according to the current usage state of the system.
  • the current usage state of the system in this embodiment is represented by the current CPU occupancy rate and the current memory usage rate.
  • the current usage state of the system is defined in advance.
  • N the value of N can be set empirically, preferably 1.3
  • ie X + Y ⁇ N the system is currently in the default idle state.
  • the system When the sum of the CPU occupancy rate and the memory usage rate of the system is greater than or equal to the first set value N and less than the second set value M, that is, N ⁇ X + Y ⁇ M, the system is considered to be in the preset non-idle state.
  • different scanning policies are set for the sum of the CPU occupancy rate and the memory usage rate, including: an idle scanning policy and a phase scanning policy.
  • the idle scanning policy is adopted.
  • a phase scanning strategy is adopted.
  • the file is scanned using a stage scanning strategy.
  • the value of M can be set empirically, preferably 2.
  • scanning the file by using an idle scanning policy means continuously scanning the file until the files to be scanned are scanned.
  • scanning scheme that is, the scanning policy when the user clicks to browse:
  • the file scanning by the idle scanning policy or the phase scanning policy when a click command of the user clicking a file or a folder is received, the file in the file or folder that the user clicks is preferentially scanned.
  • the file or the folder in which the file is located is scanned. All files.
  • the json string can be obtained by calling the java program.
  • the Json data structure can be as shown in Table 1 below: Data field Description Name File/folder name Type Type: video , audio, image, apk , textfile, dir Path relative path HasSonDir Is there a subdirectory? Thumbnailpath Thumbnail path Sons All subfolders or files under this directory, if there are subdirectories in the directory, the subdirectories are recursive data fields
  • the file is to be scanned by acquiring the file to be scanned; obtaining the CPU occupancy rate and the memory usage rate of the system; determining the current usage state of the system according to the CPU occupancy rate and the memory usage rate of the system, and selecting according to the usage state.
  • the corresponding scanning strategy scans the file. Therefore, under the condition that the system software is running normally, the files are classified and scanned according to the current usage state (CPU occupancy rate and memory usage rate) of the system, which can ensure the stability and high performance of the system, and can also meet the needs of users.
  • the need for document classification scanning brings a better experience to consumers.
  • a preferred embodiment of the present invention provides a file scanning terminal, including: a file obtaining module 201, a parameter obtaining module 202, and a scanning module 203, wherein:
  • a file obtaining module 201 configured to acquire a file to be scanned
  • the parameter obtaining module 202 is configured to acquire a current CPU occupancy rate and a memory usage rate of the system.
  • the scanning module 203 is configured to determine a current usage state of the system according to the current CPU occupancy rate and the memory usage rate of the system, and select a corresponding scanning policy to scan the file to be scanned according to the current usage state of the system.
  • the file to be scanned in this embodiment may be a media file, a text file, or other types of files.
  • the media file is used as an example, and the media file is scanned for other applications to call.
  • the file to be scanned may be obtained from the local terminal, or the file to be scanned may be obtained from an external device (such as an SD card), and the external device may be connected to the local terminal through the USB data line, or may be Local terminal wireless connection.
  • the local terminal can be a PC or a mobile terminal such as a mobile phone or a tablet.
  • the current usage state of the system in this embodiment is represented by the current CPU occupancy rate and the current memory usage rate.
  • the current usage state of the system is defined in advance.
  • N the value of N can be set empirically, preferably 1.3
  • ie X + Y ⁇ N the system is currently in the default idle state.
  • the system When the sum of the CPU occupancy rate and the memory usage rate of the system is greater than or equal to the first set value N and less than the second set value M, that is, N ⁇ X + Y ⁇ M, the system is considered to be in the preset non-idle state.
  • different scanning policies are set for the sum of the CPU occupancy rate and the memory usage rate, including: an idle scanning policy and a phase scanning policy.
  • the idle scanning policy is adopted.
  • a phase scanning strategy is adopted.
  • the scanning module 203 calculates a sum of a CPU occupancy rate and a memory usage rate of the system
  • N can be set empirically, preferably 1.3.
  • the file is scanned using a stage scanning strategy.
  • the value of M can be set empirically, preferably 2.
  • scanning the file by using an idle scanning policy means that the scanning module 203 continuously scans the file until the files to be scanned are scanned.
  • scanning scheme that is, the scanning policy when the user clicks to browse:
  • the file scanning by the idle scanning policy or the phase scanning policy when a click command of the user clicking a file or a folder is received, the file in the file or folder that the user clicks is preferentially scanned.
  • the file or the folder in which the file is located is scanned. All files.
  • the json string can be obtained by calling the java program.
  • the Json data structure can be as shown in Table 1 above.
  • the file acquiring module 201 obtains the file to be scanned by the file obtaining module 201; the parameter obtaining module 202 obtains the CPU occupancy rate and the memory usage rate of the system; and the scanning module 203 determines the system according to the CPU occupancy rate and the memory usage rate of the system.
  • the current usage state selects a corresponding scanning policy according to the usage state to scan the file. Therefore, under the condition that the system software is running normally, the files are classified and scanned according to the current usage state (CPU occupancy rate and memory usage rate) of the system, which can ensure the stability and high performance of the system, and can also meet the needs of users.
  • the need for document classification scanning brings a better experience to consumers.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明涉及一种文件扫描方法及终端,其方法包括:获取待扫描的文件;获取系统当前的CPU占有率和内存使用率;根据系统当前的CPU占有率和内存使用率判断当前的使用状态,根据系统当前的使用状态,选择相应的扫描策略对待扫描的文件进行扫描。本发明在保证系统软件正常运行的条件下,根据系统当前的使用状态(CPU占有率和内存使用率)对文件进行分类扫描,既可以保证系统的稳定性和高性能,也可以满足用户需要文件分类扫描的需求。

Description

文件扫描方法及终端
技术领域
本发明涉及文件处理技术领域,尤其涉及一种文件扫描方法及终端。
背景技术
目前,文件分类扫描技术在很多平台上都已实现。但是,现有的文件分类扫描软件在进行文件分类扫描的过程中,需要占用大量的CPU、内存资源,造成软件系统运行缓慢,甚至带来系统运行死机问题。
发明内容
本发明的主要目的在于提供一种文件扫描方法及终端,旨在不影响系统正常运行的情况下,动态进行文件分类扫描,保证系统的稳定性和高性能。
为了达到上述目的,本发明提出一种文件扫描方法,包括:
获取待扫描的文件;
获取系统当前的CPU占有率和内存使用率;
根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态,选择相应的扫描策略对所述待扫描的文件进行扫描。
优选地,所述根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态,选择相应的扫描策略对所述待扫描的文件进行扫描的步骤包括:
计算所述系统当前的CPU占有率和内存使用率之和;
当所述系统当前的CPU占有率和内存使用率之和小于第一设定值N时,采用空闲扫描策略对所述待扫描的文件进行扫描;
当所述系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,采用阶段扫描策略对所述待扫描的文件进行扫描;其中, N<M。
优选地,所述采用空闲扫描策略对所述待扫描的文件进行扫描的步骤包括:
对所述待扫描的文件进行持续扫描,直至所述待扫描的文件都被扫描。
优选地,所述采用阶段扫描策略对所述文件进行扫描的步骤包括:
对预定数量K个文件进行扫描;
当扫描完成预定数量K个文件时,向系统发出扫描完成的广播消息,由系统对界面显示的扫描数据进行刷新;
通过标志位记录已扫描完成的文件索引;
待系统满足N≤X + Y < M 时,再继续对未扫描的文件中的K个进行扫描,依次进行下去,直至所述待扫描文件都被扫描完成。
优选地,该方法还包括:
在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件;或者
对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
优选地,所述获取待扫描的文件的步骤包括:
从本地获取待扫描的文件,和/或,从外部设备获取待扫描的文件。
本发明实施例还提出一种文件扫描终端,包括:
文件获取模块,用于获取待扫描的文件;
参数获取模块,用于获取系统当前的CPU占有率和内存使用率;
扫描模块,用于根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态,选择相应的扫描策略对所述待扫描的文件进行扫描。
优选地,所述扫描模块,还用于计算所述系统当前的CPU占有率和内存使用率之和;当所述系统当前的CPU占有率和内存使用率之和小于第一设定值N时,采用空闲扫描策略对所述待扫描的文件进行扫描;当所述系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,采用阶段扫描策略对所述待扫描的文件进行扫描;其中,N < M。
优选地,所述扫描模块,还用于在空闲扫描策略下,对所述待扫描的文件进行持续扫描,直至所述待扫描的文件都被扫描;在阶段扫描策略下,对预定数量K个文件进行扫描;当扫描完成预定数量K个文件时,向系统发出扫描完成的广播消息,由系统对界面显示的扫描数据进行刷新;通过标志位记录已扫描完成的文件索引;待系统满足N≤X + Y < M 时,再继续对未扫描的文件中的K个进行扫描,依次进行下去,直至所述待扫描文件都被扫描完成。
优选地,所述扫描模块,还用于在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件;或者对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
本发明实施例提出的一种文件扫描方法及终端,通过获取待扫描的文件;获取系统当前的CPU占有率和内存使用率;根据系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据系统当前的使用状态,选择相应的扫描策略对文件进行扫描,由此,在保证系统软件正常运行的条件下,根据系统当前的使用状态(CPU占有率和内存使用率)对文件进行分类扫描,既可以保证系统的稳定性和高性能,也可以满足用户需要文件分类扫描的需求。
附图说明
图1是本发明文件扫描方法较佳实施例的流程示意图;
图2是本发明文件扫描终端较佳实施例的功能模块示意图。
为了使本发明的技术方案更加清楚、明了,下面将结合附图作进一步详述。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明实施例的解决方案主要是:通过获取待扫描的文件;获取当前系统的CPU占有率和内存使用率;根据所述系统的CPU占有率和内存使用率判断系统当前的使用状态,根据所述使用状态选择相应的扫描策略对文件进行扫描。由此,在保证系统软件正常运行的条件下,根据系统当前的使用状态(CPU占有率和内存使用率)对文件进行分类扫描,既可以保证系统的稳定性和高性能,也可以满足用户需要文件分类扫描的需求。
如图1所示,本发明较佳实施例提出一种文件扫描方法,包括:
步骤S101,获取待扫描的文件;
其中,本实施例中待扫描的文件可以为媒体文件、文本文件或者其他类型的文件等,本实施例以媒体文件进行举例,通过对媒体文件的扫描,以供其他应用进行调用。
在获取待扫描的文件时,可以从本地终端获取待扫描的文件,也可以从外部设备(比如SD卡)获取待扫描的文件,该外部设备可以通过USB数据线与本地终端连接,也可以与本地终端无线连接。本地终端可以为PC端,也可以为手机、平板电脑等移动终端。
步骤S102,获取系统当前的CPU占有率和内存使用率;
实时监测本地终端系统的CPU占有率和内存(memory)使用率,以便根据系统的CPU占有率和内存使用率判断当前系统的CPU和内存是否处于空闲状态。
步骤S103,根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态选择相应的扫描策略对所述待扫描的文件进行扫描。
本实施例所述系统当前使用状态通过CPU当前占有率和内存当前使用率来表示。
首先,对所述系统当前的使用状态预先进行定义,当系统的CPU占有率X和内存使用率Y之和小于某一设定值N(N的值可以根据经验设定,优选为1.3)时,即X + Y < N时,则认为系统当前处于预设的空闲状态。
当系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,即N≤X + Y <M时,认为系统当前处于预设非空闲状态。
本实施例针对CPU占有率和内存使用率之和的大小,设定有不同的扫描策略,具体包括:空闲扫描策略和阶段扫描策略,当系统当前处于预设的空闲状态时,采用空闲扫描策略;当系统当前处于预设非空闲状态,采用阶段扫描策略。此外,还设置有第三种策略,用户点击浏览时扫描策略。
具体过程如下:
首先计算所述系统的CPU占有率和内存使用率之和;
当所述系统的CPU占有率和内存使用率之和小于第一设定值N时,即X + Y < N时,采用空闲扫描策略对文件进行扫描。
其中,N的值可以根据经验设定,优选为1.3。
当所述系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,即N≤X + Y <M时,采用阶段扫描策略对所述文件进行扫描。其中,M的值可以根据经验设定,优选为2。
更为具体地,其中,采用空闲扫描策略对所述文件进行扫描是指:对所述文件进行持续扫描直至所述待扫描文件都被扫描。
采用阶段扫描策略对所述文件进行扫描是指:首先对预定数量K(比如K=50)个文件进行扫描,当扫描完成后,向系统发出扫描完成的广播消息,由系统对界面显示的扫描数据进行刷新;且通过标志位记录已扫描完成的文件索引,待系统满足N≤X + Y < M 时,再继续对未扫描的文件中的K个进行扫描分析,依次进行下去,直至所述待扫描文件都被扫描完成。
进一步地,还可以采用如下扫描方案,即用户点击浏览时扫描策略:
在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件。
或者,对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
对于扫描完成的文件,可以对文件进行存储,具体可以通过json字符串的格式进行存储,包括对文件内容以及文件类型、文件索引、文件属性、存储路径、缩略图、是否有子目录等信息进行存储。外部应用在调用扫描的文件时,可以通过java程序调用得到json字符串。
Json数据结构可以如下表1所示:
数据域 说明
Name 文件/文件夹名
Type 类型:video , audio, image, apk , textfile, dir
Path 相对路径
HasSonDir 是否有子目录
Thumbnailpath 缩略图路径
Sons 该目下的所有子文件夹或文件,如果该目录中有子目录,则子目录为递归的数据域
本实施例通过上述方案,通过获取待扫描的文件;获取系统的CPU占有率和内存使用率;根据所述系统的CPU占有率和内存使用率判断系统当前的使用状态,根据所述使用状态选择相应的扫描策略对文件进行扫描。由此,在保证系统软件正常运行的条件下,根据系统当前的使用状态(CPU占有率和内存使用率)对文件进行分类扫描,既可以保证系统的稳定性和高性能,也可以满足用户需要文件分类扫描的需求,给消费者带来比较好的体验。
如图2所示,本发明较佳实施例提出一种文件扫描终端,包括:文件获取模块201、参数获取模块202以及扫描模块203,其中:
文件获取模块201,用于获取待扫描的文件;
参数获取模块202,用于获取系统当前的CPU占有率和内存使用率;
扫描模块203,用于根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态选择相应的扫描策略对所述待扫描的文件进行扫描。
本实施例中待扫描的文件可以为媒体文件、文本文件或者其他类型的文件等,本实施例以媒体文件进行举例,通过对媒体文件的扫描,以供其他应用进行调用。
在获取待扫描的文件时,可以从本地终端获取待扫描的文件,也可以从外部设备(比如SD卡)获取待扫描的文件,该外部设备可以通过USB数据线与本地终端连接,也可以与本地终端无线连接。本地终端可以为PC端,也可以为手机、平板电脑等移动终端。
本实施例所述系统当前使用状态通过CPU当前占有率和内存当前使用率来表示。
首先,对所述系统当前的使用状态预先进行定义,当系统的CPU占有率X和内存使用率Y之和小于某一设定值N(N的值可以根据经验设定,优选为1.3)时,即X + Y < N时,则认为系统当前处于预设的空闲状态。
当系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,即N≤X + Y <M时,认为系统当前处于预设非空闲状态。
本实施例针对CPU占有率和内存使用率之和的大小,设定有不同的扫描策略,具体包括:空闲扫描策略和阶段扫描策略,当系统当前处于预设的空闲状态时,采用空闲扫描策略;当系统当前处于预设非空闲状态,采用阶段扫描策略。此外,还设置有第三种策略,用户点击浏览时扫描策略。
具体过程如下:
首先,扫描模块203计算所述系统的CPU占有率和内存使用率之和;
当所述系统的CPU占有率和内存使用率之和小于第一设定值N时,即X + Y < N时,采用空闲扫描策略对文件进行扫描。
其中,N的值可以根据经验设定,优选为1.3。
当所述系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,即N≤X + Y <M时,采用阶段扫描策略对所述文件进行扫描。其中,M的值可以根据经验设定,优选为2。
更为具体地,其中,采用空闲扫描策略对所述文件进行扫描是指:扫描模块203对所述文件进行持续扫描直至所述待扫描文件都被扫描。
采用阶段扫描策略对所述文件进行扫描是指:扫描模块203首先对预定数量K(比如K=50)个文件进行扫描,当扫描完成后,向系统发出扫描完成的广播消息,由系统对界面显示的扫描数据进行刷新;且通过标志位记录已扫描完成的文件索引,待系统满足N≤X + Y < M 时,再继续对未扫描的文件中的K个进行扫描分析,依次进行下去,直至所述待扫描文件都被扫描完成。
进一步地,还可以采用如下扫描方案,即用户点击浏览时扫描策略:
在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件。
或者,对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
对于扫描完成的文件,可以对文件进行存储,具体可以通过json字符串的格式进行存储,包括对文件内容以及文件类型、文件索引、文件属性、存储路径、缩略图、是否有子目录等信息进行存储。外部应用在调用扫描的文件时,可以通过java程序调用得到json字符串。
Json数据结构可以如上表1所示。
本实施例通过上述方案,通过文件获取模块201获取待扫描的文件;参数获取模块202获取系统的CPU占有率和内存使用率;扫描模块203根据所述系统的CPU占有率和内存使用率判断系统当前的使用状态,根据所述使用状态选择相应的扫描策略对文件进行扫描。由此,在保证系统软件正常运行的条件下,根据系统当前的使用状态(CPU占有率和内存使用率)对文件进行分类扫描,既可以保证系统的稳定性和高性能,也可以满足用户需要文件分类扫描的需求,给消费者带来比较好的体验。
以上所述仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或流程变换,或直接或间接运用在其它相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (20)

  1. 一种文件扫描方法,其特征在于,包括:
    获取待扫描的文件;
    获取系统当前的CPU占有率和内存使用率;
    根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态,选择相应的扫描策略对所述待扫描的文件进行扫描。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态,选择相应的扫描策略对所述待扫描的文件进行扫描的步骤包括:
    计算所述系统当前的CPU占有率和内存使用率之和;
    当所述系统当前的CPU占有率和内存使用率之和小于第一设定值N时,采用空闲扫描策略对所述待扫描的文件进行扫描;
    当所述系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,采用阶段扫描策略对所述待扫描的文件进行扫描;其中,N<M。
  3. 根据权利要求2所述的方法,其特征在于,所述采用空闲扫描策略对所述待扫描的文件进行扫描的步骤包括:
    对所述待扫描的文件进行持续扫描,直至所述待扫描的文件都被扫描。
  4. 根据权利要求2所述的方法,其特征在于,所述采用阶段扫描策略对所述文件进行扫描的步骤包括:
    对预定数量K个文件进行扫描;
    当扫描完成预定数量K个文件时,向系统发出扫描完成的广播消息,由系统对界面显示的扫描数据进行刷新;
    通过标志位记录已扫描完成的文件索引;
    待系统满足N≤X + Y < M 时,再继续对未扫描的文件中的K个进行扫描,依次进行下去,直至所述待扫描文件都被扫描完成。
  5. 根据权利要求2所述的方法,其特征在于,还包括:
    在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件。
  6. 根据权利要求4所述的方法,其特征在于,还包括:
    在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件。
  7. 根据权利要求2所述的方法,其特征在于,还包括:
    对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
  8. 根据权利要求4所述的方法,其特征在于,还包括:
    对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
  9. 根据权利要求1所述的方法,其特征在于,所述获取待扫描的文件的步骤包括:
    从本地获取待扫描的文件,和/或,从外部设备获取待扫描的文件。
  10. 根据权利要求1所述的方法,其特征在于,还包括:
    对于扫描完成的文件进行存储,具体通过json字符串的格式进行存储,包括对文件内容以及文件类型、文件索引、文件属性、存储路径、缩略图、是否有子目录信息进行存储。
  11. 一种文件扫描终端,其特征在于,包括:
    文件获取模块,用于获取待扫描的文件;
    参数获取模块,用于获取系统当前的CPU占有率和内存使用率;
    扫描模块,用于根据所述系统当前的CPU占有率和内存使用率判断系统当前的使用状态,根据所述系统当前的使用状态,选择相应的扫描策略对所述待扫描的文件进行扫描。
  12. 根据权利要求11所述的终端,其特征在于,
    所述扫描模块,还用于计算所述系统当前的CPU占有率和内存使用率之和;当所述系统当前的CPU占有率和内存使用率之和小于第一设定值N时,采用空闲扫描策略对所述待扫描的文件进行扫描;当所述系统的CPU占有率和内存使用率之和大于或等于第一设定值N且小于第二设定值M时,采用阶段扫描策略对所述待扫描的文件进行扫描;其中, N<M。
  13. 根据权利要求12所述的终端,其特征在于,
    所述扫描模块,还用于在空闲扫描策略下,对所述待扫描的文件进行持续扫描,直至所述待扫描的文件都被扫描。
  14. 根据权利要求12所述的终端,其特征在于,
    所述扫描模块,还用于在阶段扫描策略下,对预定数量K个文件进行扫描;当扫描完成预定数量K个文件时,向系统发出扫描完成的广播消息,由系统对界面显示的扫描数据进行刷新;通过标志位记录已扫描完成的文件索引;待系统满足N≤X + Y < M 时,再继续对未扫描的文件中的K个进行扫描,依次进行下去,直至所述待扫描文件都被扫描完成。
  15. 根据权利要求12所述的终端,其特征在于,
    所述扫描模块,还用于在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件。
  16. 根据权利要求14所述的终端,其特征在于,
    所述扫描模块,还用于在通过所述空闲扫描策略或阶段扫描策略进行文件扫描的过程中,当接收到用户点击文件或文件夹的点击指令时,优先扫描用户点击的文件或文件夹内的文件。
  17. 根据权利要求12所述的终端,其特征在于,
    所述扫描模块,还用于对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
  18. 根据权利要求14所述的终端,其特征在于,
    所述扫描模块,还用于对于所述空闲扫描策略和阶段扫描策略未完成扫描的文件,当用户点击该文件或该文件所在的文件夹时,根据用户的点击操作,扫描所述文件或所述文件所在文件夹内的所有文件。
  19. 根据权利要求11所述的终端,其特征在于,
    所述文件获取模块,还用于从本地获取待扫描的文件,和/或,从外部设备获取待扫描的文件。
  20. 根据权利要求11所述的终端,其特征在于,
    所述扫描模块,还用于对于扫描完成的文件进行存储,具体通过json字符串的格式进行存储,包括对文件内容以及文件类型、文件索引、文件属性、存储路径、缩略图、是否有子目录信息进行存储。
PCT/CN2015/092211 2014-12-24 2015-10-19 文件扫描方法及终端 Ceased WO2016101686A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410816882.9 2014-12-24
CN201410816882.9A CN105791614B (zh) 2014-12-24 2014-12-24 文件扫描方法及终端

Publications (1)

Publication Number Publication Date
WO2016101686A1 true WO2016101686A1 (zh) 2016-06-30

Family

ID=56149195

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/092211 Ceased WO2016101686A1 (zh) 2014-12-24 2015-10-19 文件扫描方法及终端

Country Status (2)

Country Link
CN (1) CN105791614B (zh)
WO (1) WO2016101686A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107450985A (zh) * 2017-07-27 2017-12-08 北京珠穆朗玛移动通信有限公司 内存管理方法、移动终端及存储介质
CN111931099A (zh) * 2020-06-17 2020-11-13 安徽三实信息技术服务有限公司 一种网页漏洞扫描系统
CN114706825A (zh) * 2022-04-22 2022-07-05 北斗星通智联科技有限责任公司 文件扫描方法、装置、终端设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7069594B1 (en) * 2001-06-15 2006-06-27 Mcafee, Inc. File system level integrity verification and validation
CN102411628A (zh) * 2011-12-19 2012-04-11 Tcl集团股份有限公司 基于android系统的文件扫描方法及装置
CN102662781A (zh) * 2012-04-11 2012-09-12 腾讯科技(深圳)有限公司 一种保障终端正常运行的方法及装置
CN103366118A (zh) * 2012-04-06 2013-10-23 腾讯科技(深圳)有限公司 进行安装包病毒查杀的方法及装置
CN103577240A (zh) * 2012-07-25 2014-02-12 腾讯科技(深圳)有限公司 系统自动清理方法、装置及存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103679022B (zh) * 2012-09-20 2016-04-20 腾讯科技(深圳)有限公司 病毒扫描方法和装置
CN103246592B (zh) * 2013-05-13 2016-12-28 北京搜狐新媒体信息技术有限公司 一种监控采集系统及方法
CN103559443B (zh) * 2013-11-01 2017-07-14 北京奇虎科技有限公司 多核设备的病毒扫描方法和装置
CN103744911A (zh) * 2013-12-26 2014-04-23 乐视网信息技术(北京)股份有限公司 一种视频文件扫描方法及电子设备
CN104102465A (zh) * 2014-07-09 2014-10-15 宁波摩视光电科技有限公司 基于高精度大幅面扫描仪系统的图像快速显示方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7069594B1 (en) * 2001-06-15 2006-06-27 Mcafee, Inc. File system level integrity verification and validation
CN102411628A (zh) * 2011-12-19 2012-04-11 Tcl集团股份有限公司 基于android系统的文件扫描方法及装置
CN103366118A (zh) * 2012-04-06 2013-10-23 腾讯科技(深圳)有限公司 进行安装包病毒查杀的方法及装置
CN102662781A (zh) * 2012-04-11 2012-09-12 腾讯科技(深圳)有限公司 一种保障终端正常运行的方法及装置
CN103577240A (zh) * 2012-07-25 2014-02-12 腾讯科技(深圳)有限公司 系统自动清理方法、装置及存储介质

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107450985A (zh) * 2017-07-27 2017-12-08 北京珠穆朗玛移动通信有限公司 内存管理方法、移动终端及存储介质
CN111931099A (zh) * 2020-06-17 2020-11-13 安徽三实信息技术服务有限公司 一种网页漏洞扫描系统
CN114706825A (zh) * 2022-04-22 2022-07-05 北斗星通智联科技有限责任公司 文件扫描方法、装置、终端设备及存储介质

Also Published As

Publication number Publication date
CN105791614A (zh) 2016-07-20
CN105791614B (zh) 2019-05-10

Similar Documents

Publication Publication Date Title
WO2019174090A1 (zh) 截屏文件分享的控制方法、装置、设备和计算机存储介质
WO2011021909A2 (en) Method and apparatus for providing contents via network, method and apparatus for receiving contents via network, and method and apparatus for backing up data via network, backup data providing device, and backup system
WO2010079883A2 (en) Method and apparatus for reproducing content through integrated channel management
WO2017157146A1 (zh) 基于用户画像的个性化推荐方法、装置、服务器及存储介质
WO2018214320A1 (zh) 数据库业务逻辑监控方法、系统、及存储介质
WO2018233352A1 (zh) 数据传输方法、装置、终端以及计算机可读存储介质
WO2014071755A1 (zh) 实现移动终端应用程序下载的方法及移动终端
WO2016095071A1 (zh) 一种视频处理方法、装置及播放装置
WO2016141667A1 (zh) 一种移动终端的网络连接控制方法及系统
WO2014008858A1 (zh) 实现跨域跳转的方法以及浏览器、域名服务器
WO2017142143A1 (en) Method and apparatus for providing summary information of a video
WO2012119494A1 (zh) 动态调整桌面布局的方法及系统、计算机存储介质
WO2014098539A1 (en) User terminal apparatus and control method thereof
WO2017057960A1 (en) Electronic device and method for controlling the same
WO2014059723A1 (zh) 视频图像质量诊断系统及其方法
WO2020233060A1 (zh) 事件通知方法、事件通知服务器、存储介质及装置
WO2017092398A1 (zh) 一种基于移动终端的拍照方法及该移动终端
EP3039564A1 (en) Method for sharing media data and electronic device thereof
WO2018076863A1 (zh) 数据存储的方法、装置、存储介质、服务器及系统
WO2017148142A1 (zh) 桌面图标文件夹的名称切换方法、装置及电子设备
WO2015037827A1 (en) Display apparatus and controlling method thereof
WO2019184436A1 (zh) 视频推送方法、装置及计算机可读存储介质
WO2013123816A1 (zh) 手机及其文件配置方法
WO2013027879A1 (en) Content device and control method thereof
WO2016090650A1 (zh) 在视频应用中插播广告的终端及方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15871759

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC , EPO FORM 1205A DATED 17.11.17.

122 Ep: pct application non-entry in european phase

Ref document number: 15871759

Country of ref document: EP

Kind code of ref document: A1