Pesquisa Imagens Maps Play YouTube Notícias Gmail Drive Mais »
Fazer login
Usuários de leitores de tela: para usar o modo de acessibilidade, é preciso clicar neste link. O modo de acessibilidade tem os mesmos recursos básicos, mas funciona melhor com seu leitor de tela.

Patentes

  1. Pesquisa avançada de patentes
Número da publicaçãoCN102968173 A
Tipo de publicaçãoRequerimento
Número do pedidoCN 201210421845
Data de publicação13 mar. 2013
Data de depósito30 out. 2012
Data da prioridade28 set. 2012
Também publicado comoCN102968173B
Número da publicação201210421845.9, CN 102968173 A, CN 102968173A, CN 201210421845, CN-A-102968173, CN102968173 A, CN102968173A, CN201210421845, CN201210421845.9
Inventores牛建伟, 宋文芳
Requerente北京航空航天大学
Exportar citaçãoBiBTeX, EndNote, RefMan
Links externos:  SIPO (escritório de patentes da China), Espacenet
Bandwidth self-adaption code migration-based energy saving method for mobile equipment
CN 102968173 A
Resumo
The invention discloses a bandwidth self-adaption code migration-based energy saving method for mobile equipment. The energy saving method comprises the following steps of: constructing a weighting object relation graph through performing static and dynamic analysis on a mobile application, therefore, transforming an application partitioning problem into an object relation graph partitioning problem; proposing a running time and energetic optimum-based target model by taking varied bandwidth in a mobile environment to serve as a variable; proposing a bandwidth self-adaption branch and bound application partitioning method (BBAP) and a minimum cut-based greedy application partitioning method (MCGAP) by aiming at an application partitioning optimization model; and finally, realizing code migration and distributed execution on the mobile application between the mobile equipment and a server based on the obtained partitioning scheme. According to the method disclosed by the invention, the running time of the mobile application can be effectively shortened, and the power consumption of the mobile equipment is reduced. Moreover, the method disclosed by the invention is good in adaptability to bandwidth variations.
Reivindicações(5)  traduzidas do Chinês
1. 一种基于带宽自适应代码迁移的移动设备节能方法,在移动环境带宽不断变化的情况下,其特征在于,该移动设备节能方法通过下面步骤实现: 步骤I:构造加权对象关系图,具体是:首先,进行静态程序分析,根据程序的方法调用关系,构造程序初始的对象关系图,对象关系图中的各节点和边分别对应程序中的对象和对象间的调用关系;然后,通过动态程序分析获得对象关系图中各节点对象的运行时间以及每条边的通信数据量,得到加权对象关系图; 步骤2 :基于加权对象关系图,将带宽作为一个变量,建立基于运行时间和耗电量的程序分割优化模型,具体是:令Xi标识节点i的运行位置,Xi=I和Xi=O分别表示节点i在移动设备和服务器端运行,程序分割方案表示为X = Ix1, X2,…,χη},η为加权对象关系图中的节点个数,则程序分割优化模型的目标在于求得最优分割方案J ^^ = argminr(X,6),Xp为模型求解空间,b表示当前带宽,ff(X, b)表示当前带宽为b时程序分割方案X的优化模型,具体定义如下: W(X,b) =WtXT(X,b)/TLocal+weXE(X,b)/Eloc31 其中,TLocal和Ekjcal分别表示程序全部运行在移动设备的运行时间和耗电量;wt和We分别表示运行时间和耗电量的权重,且满足wt+we= I ;T(X, b)和E(X,b)分别表示当前带宽为b时采用程序分割方案X的程序运行时间和耗电量; 所述的模型求解空间Xp定义为={x IW{X,b,)< w{x^,b,y(\ + a)^,其中,带宽阈值Id1为满足概率P (b彡bx)彡P。 An adaptive code migration based bandwidth saving method of a mobile device, in the case of changing the bandwidth of a mobile environment, characterized in that the mobile device through the following steps to achieve energy-saving method: Step I: weighted object graph construction, concrete are: First, static program analysis method according to the program call relation, constructor initial object graph, object graph of nodes and edges corresponding to the program calling relationships between objects and object; then, through dynamic program analysis to get the running time of each node object and traffic data for each edge object graph to obtain a weighted object graph; Step 2: Based on weighted object graph, a variable bandwidth as established based on the operating time and power consumption The Program is divided optimization model, specifically: Let Xi identifies the node i running position, Xi = I and Xi = O i denote the node running the mobile device and the server, program segmentation scheme expressed as X = Ix1, X2, ... , χη}, η is the number of nodes in a weighted object graph, the program aims to split the optimization model to obtain optimal partitioning scheme J ^^ = argminr (X, 6), Xp as a model solution space, b represents the current Bandwidth, ff (X, b) when b represents the current bandwidth optimization model segmentation program X of the program, defined as follows: W (X, b) = WtXT (X, b) / TLocal + weXE (X, b) / Eloc31 wherein, TLocal and Ekjcal represent all the procedures in the Run time and power consumption of mobile devices; wt and We denote the right operating time and power consumption of the heavy, satisfying wt + we = I; T (X, b), and E (X, b) denote the current bandwidth is b with the program run time and power consumption program into program X; the model of the solution space is defined as Xp = {x IW {X, b,) <w {x ^, b, y (\ + a) ^, wherein the bandwidth threshold Id1 to satisfy the probability P (b San bx) San P. 的最大带宽值,P。 The maximum bandwidth value, P. 为所设定的概率阈值为带宽h下最优程序分割方案对应的优化模型值;经验常数a > O ; 步骤3 :进行带宽自适应程序分割,在节点个数η不超过200时,采用分支定界程序分割方法寻找最优分割方案,在节点个数η大于200时,采用基于最小割的贪心方法来寻找最优分割方案; 所述的分支定界程序分割方法基于分支定界深度优先搜索法,深度搜索的约束条件包括: O程序分割方案在当前带宽b下对应的优化模型值小于当前保存的优化模型的最小值;2)程序分割方案在带宽阈值Id1下的模型目标值不高于所设定模型上限值π(χζ,ύ)χ(\+α); 所述的基于最小割的贪心方法,利用Stoer-Wagner最小割算法求得带宽为b和Id1时对应的运行在移动设备的节点集合Cb和运行在服务器端的节点集合&,令待分割节点V, 二V-Cb-Sbt,对V'中节点进行分割,采用Stoer-Wagner最小割算法中的最大邻接值排序算法对节点进行排序,然后基于贪心策略,同时根据与分支定界程序分割方法中相同的深度搜索的约束条件选取最优分割方案; 步骤4 :根据得到的最优分割方案,实现程序在移动设备和服务器间的代码迁移和分布式执行。 To the set bandwidth optimization model probability threshold value corresponding to the next best program segmentation program h; the empirical constant a> O; Step 3: bandwidth adaptive segmentation procedure, when the number of nodes η does not exceed 200, the branch When the delimitation program segmentation method to find the optimal partitioning scheme, the number of nodes η greater than 200, based on minimum cut greedy method to find the optimal segmentation scheme; branch and bound procedure described segmentation method based on branch and bound depth first search France, the constraints include depth search: O program segmentation scheme in the current bandwidth b corresponding optimization model smaller than the minimum current saved optimization model; 2) program into the program model in the bandwidth threshold target is not higher than Id1 Limits on the model π (χζ, ύ) χ (\ + α) set; the greedy method based on minimum cut, the use of Stoer-Wagner minimum cut algorithm to obtain the bandwidth b and Id1 for the corresponding run on mobile node apparatus set Cb and running on the node server set &, so be split node V, two V-Cb-Sbt, for V 'in the node segmentation using Stoer-Wagner minimum cut algorithm maximum adjacent value sorting algorithm sort the nodes and greedy strategies, while according to the constraints and branch and bound program segmentation same depth search of selecting the optimal partitioning scheme; Step 4: According to the optimal partitioning scheme was to achieve the program in the mobile device and the server code migration between and distributed execution.
2.根据权利要求I所述的一种基于带宽自适应代码迁移的移动设备节能方法,其特征在于,所述的概率阈值P。 2. I said one claim code migration based on adaptive bandwidth saving mobile device, characterized in that the probability threshold P. 设定为O. 85。 Set to O. 85.
3.根据权利要求I所述的一种基于带宽自适应代码迁移的移动设备节能方法,其特征在于,所述的经验常数a设定为O. 4。 3. I said one claim code migration based bandwidth adaptive energy-saving method of a mobile device, wherein said empirical constant a set O. 4.
4.根据权利要求I所述的一种基于带宽自适应代码迁移的移动设备节能方法,其特征在于,步骤2中所述的带宽为b时采用程序分割方案X的程序运行时间T(X,b)为: 4. According to one of claim I based bandwidth adaptive code migration energy-saving method of a mobile device, wherein the bandwidth of the Step 2 program to use when b segmentation scheme X program run time T (X, b) as follows:
Figure CN102968173AC00031
其中,tnli与tnsi分别表示节点i在移动设备与服务器端的运行时间;tnli为加权对象关系图中对应节点i的权重,设服务器计算速度是移动设备的k倍,则:tnsi=tnli/k ;令1」表示移动设备与服务器端的通信数据量,则带宽为b时节点i,j间数据传输时间为:tu =WijA。 Wherein, tnli and tnsi represent node i run time in mobile devices and server; tnli weighted object graph in the corresponding node i weights located server computing speed is a mobile device k times, then: tnsi = tnli / k; ORDER 1 "means that the data traffic of the mobile device and the server, the bandwidth of a node is b i, j between data transmission time is: tu = WijA.
5.根据权利要求I所述的一种基于带宽自适应代码迁移的移动设备节能方法,其特征在于,步骤2中所述的带宽为b时采用程序分割方案X的程序耗电量E (X,b)为: 5. I said one claim code migration based bandwidth adaptive energy-saving method of a mobile device, wherein the bandwidth as described in step 2 b program when segmentation scheme using the program X consumption E (X , b) as follows:
Figure CN102968173AC00032
其中,Ei表示节点i在移动设备上运行的耗电量,Ei = tniiXPcpu ;Eij表示节点i,j之间数据传输的耗电量,Eij = tuXPw丨_表示移动设备的CPU功率,Pw表示移动设备WiFi接口的数据通信功率。 Where, Ei represents power node i to run on mobile devices, Ei = tniiXPcpu; Eij represents node i, j of power consumption data transfer between, Eij = tuXPw Shu _ indicates CPU power mobile devices, Pw represents mobile Data communications equipment power WiFi interface.
Descrição  traduzidas do Chinês

一种基于带宽自适应代码迁移的移动设备节能方法 An energy-saving method for a mobile device based on the bandwidth of the adaptive code migration

技术领域 Technical Field

[0001] 本发明属于移动计算领域,具体涉及一种基于带宽自适应代码迁移的移动设备节能方法。 [0001] The present invention belongs to the field of mobile computing, in particular to a mobile device saving method based on adaptive bandwidth of code migration.

背景技术 Background

[0002] 移动设备因其轻巧便携、使用方便等优点,逐渐成为用户量最大的计算平台。 [0002] The mobile device because of its lightweight and portable, and easy to use, has become the largest user of computing platforms. 随着移动用户的需求不断增长,移动设备的性能不断提升,电池容量已经成为移动设备进一步发展的瓶颈问题。 With the growing demand for mobile users, and improve the performance of mobile devices, battery capacity has become a bottleneck of the further development of mobile devices. 近年来,基于程序分割的代码迁移技术逐渐应用于移动计算领域,成为缓解移动设备资源有限问题的一种有效方法。 In recent years, based on segmentation program code migration technology is increasingly used in mobile computing, has become an effective way to alleviate the problem of limited resources of mobile devices. 根据程序分割方案将应用程序的一部分代码迁移到服务器端运行,可以缩短应用程序的运行时间,降低移动设备的能量消耗。 According to program into the program will migrate part of the application code to the server running, you can shorten the running time of the application, reducing the energy consumption of mobile devices.

[0003] 面向对象应用程序的复杂性和多样性为实现程序分割带来了挑战。 [0003] The object-oriented applications for the realization of the complexity and diversity of the program is divided challenges. 国内外学者在这一领域进行了较为广泛的研究并提出了相应的方案。 Domestic and foreign scholars in the field of a more extensive research and the corresponding solutions. Eduardo等人提出的ΜΑΠ系统是基于微软通用语言运行库CLR的代码迁移系统,需要程序员事先对程序源代码中可在远端服务器执行的对象添加“Remotable”标识;Roelof等人提出的Cuckoo系统通过扩展Android编译系统,为程序员提供了一种便捷的编程模型,可以辅助程序员完成一部分工作(例如远程方法调用的实现),但仍需程序员手动实现;Shumao等人则是借助中间件实现移动设备上的程序分割和迁移。 Eduardo, who made ΜΑΠ system is based on Microsoft common language runtime CLR code migration system, programmers need to advance to the target program source code that can be executed in the remote server to add "Remotable" logo; Cuckoo system Roelof, who proposed By extending the Android build system, the programmer provides a convenient programming model, can assist programmers to complete part of the work (such as remote method invocation), but still the programmer to manually implement; Shumao and others is the use of middleware implement programs on mobile devices division and migration. 这些方案依赖于程序员或中间件工具,限制了其应用领域。 These programs rely on a programmer or middleware tools, limiting its applications.

[0004] 于是Sinha等研究者进一步提出了自动程序分割方案,这种方法无需借助额外工具,不依赖于程序员,可以透明地实现程序自动分割,适用于移动平台。 [0004] Thus Sinha et researchers further segmentation scheme proposed automatic procedure, this method without using additional tools, not dependent on the programmer, can be transparently realized automatic segmentation procedures, for mobile internet. 近年来,面向对象程序的自动分割方案大都通过对程序进行纯静态分析或纯动态分析构造程序对象关系图,并基于对象关系图(Object Relation Graph, 0RG)实现程序分割。 In recent years, object-oriented programming of automatic segmentation program mostly through the program purely static analysis or pure dynamic analysis constructor object graph, and based on the object graph (Object Relation Graph, 0RG) implement procedures segmentation. Spiegel等人和Dahm提出的Doorastha系统均采用纯静态程序分析方法构造对象关系图,不能够准确反映程序的运行态信息,因而无法获取最优的程序分割结果。 Spiegel et al. And Dahm proposed Doorastha systems use pure static program analysis method to construct the object graph can not accurately reflect the operational status information about the program, and therefore can not get the best program segmentation. 而Messer等人和Bialek等人则采用纯动态程序分析方法构造对象关系图,相比纯静态分析,纯动态程序分析能够获取更为精确的程序运行时信息,但得到的对象关系图庞大复杂,导致程序分割开销过大,不适用于资源有限的移动平台。 The Messer et al. And Bialek, who is pure dynamic program analysis method to construct the object graph, compared to a purely static analysis, pure dynamic program analysis program can obtain more accurate runtime information, but the object was large and complex diagrams, causes the program to split the cost is too great, does not apply to the limited resources of mobile platforms. Wang Lei等人通过构造两层对象关系图,提出了适用于不同目标模型的程序分割方案和基于Java的分布式系统框架,但并未对程序分割方法进行具体研究,没有考虑移动环境中带宽的变化。 Wang Lei, who object graph by constructing two proposed models for different target program partitioning scheme and distributed systems framework is based on Java, but the program did not carry out specific research division method, without considering bandwidth in a mobile environment change.

[0005] 程序分割的关键是如何选择程序的最优分割方案,尽可能实现移动设备能耗最小和数据传输开销最小。 [0005] The key to the program is how to choose the optimal segmentation segmentation program procedures as much as possible to achieve the minimum energy consuming equipment and mobile data transmission overhead to a minimum. 由于数据传输开销与网络带宽直接相关,不同的带宽会对应不同的最优分割方案。 Since the data transmission overhead directly related to network bandwidth, different bandwidth will correspond to different optimal partitioning scheme. 以往的程序分割通常假设带宽固定不变,如Diaconescu等人即根据静态带宽计算网络传输开销以决策程序分割,并未考虑网络环境因素(如带宽)的变化。 Previous program into the bandwidth is generally assumed constant, such as Diaconescu, who calculated that, according to static bandwidth network transmission overhead in decision-making process is divided and does not consider the network of environmental factors (such as bandwidth) changes. 由于移动网络环境中带宽变化频繁,传统的静态程序分割技术通常会保守地根据较低带宽决策分割方案。 Because bandwidth mobile network environment changes frequently, traditional static program segmentation techniques often conservative decisions based on lower bandwidth segmentation scheme. 然而这种分割方案在带宽较高情况下无法充分利用带宽资源,造成网络资源浪费。 However, this segmentation scheme can not fully utilize the bandwidth resources in higher bandwidth conditions, resulting in a waste of resources network. Byung-Gon等人通过分析移动设备和网络环境的异构和动态变化特性,提出了动态程序分害IJ,但频繁的程序分割任务势必为移动设备带来较大的额外开销负担。 Byung-Gon, who through the analysis of heterogeneous and dynamic nature of mobile devices and network environment, presents a dynamic program points harm IJ, but frequently the program into tasks is bound to bring a large overhead burden for mobile devices. 发明内容 DISCLOSURE

[0006] 针对移动设备能量资源有限问题,为了有效节省移动设备的能量消耗,并克服静态程序分割不适用于带宽变化的移动环境和动态程序分割额外开销较大的问题,本发明提出一种基于带宽自适应代码迁移的移动设备节能方法。 [0006] For mobile devices the problem of limited energy resources, in order to effectively save energy consumption of mobile devices, and to overcome the static program does not apply to the mobile environment and dynamic segmentation procedures for bandwidth changes in segmentation overhead larger problems, the present invention is proposed based on Bandwidth adaptive code migration of mobile equipment, energy saving methods.

[0007] 本发明的一种基于带宽自适应代码迁移的移动设备节能方法,具体过程如下: [0007] The present invention is based on an energy-saving method for a mobile device with adaptive bandwidth of code migration process is as follows:

[0008] 步骤1,构造加权对象关系图,具体是:首先,对应用程序进行静态程序分析,根据应用程序的方法调用关系,获取应用程序中的对象和对象间的调用关系,构造应用程序初始的对象关系图(Initial Object Relation Graph, IORG),对象关系图的节点和边分别对应应用程序对象和对象间的调用关系;然后,通过动态程序分析获得对象关系图中各节点对象的运行时间以及对象间的调用关系(每条边)的通信数据量,得到加权对象关系图。 [0008] Step 1 to construct a weighted object graph, specifically: First, the application of static program analysis, calls the method according to the application of the relationship, the relationship gets called application objects and between objects, construct the initial application The object graph (Initial Object Relation Graph, IORG), object graph nodes and edges corresponding to each application object and calling relationships between objects; and then, through a dynamic program analysis to obtain the runtime object graph and each node object Traffic data calls between objects (each side) to obtain a weighted object graph. [0009] 步骤2,基于以上加权对象关系图,将带宽作为一个变量,建立基于运行时间和耗电量的程序分割优化模型。 [0009] Step 2, the weighted object graph based on the above, as a variable bandwidth, establish segmentation model based on the running time and the power consumption of the program. 令Xi标识节点i的运行位置,Xi=I和Xi=O分别表示节点i在移动设备和服务器端运行,则程序分割方案可表示为X = Ix1, X2,…,χη},η为节点个数,令b表示当前带宽。 So i Xi identifies the node running position, Xi = I and Xi = O i denote the node in the mobile device and the server is running, the program segmentation scheme can be expressed as X = Ix1, X2, ..., χη}, η node months number, so that b indicates the current bandwidth. 程序分割优化模型的目标在于求得最优分割方案X,满足,Xp为模型求解空间,W(x,b)表示当前带宽为b时程序分割方案X的优化模型,具体定义如下: Program segmentation optimization model aims to find an optimum partitioning scheme X, meet, Xp as a model solution space, W (x, b) indicates the current bandwidth is b segmentation program optimization model program X, specifically defined as follows:

[0010] W(X,b) =WtXT(X,b)/TLocal+weXE(X,b)/ELocal [0010] W (X, b) = WtXT (X, b) / TLocal + weXE (X, b) / ELocal

[0011] 其中,TLocal和Ekxal分别表示程序全部运行在移动设备时的运行时间和耗电量;wt和We分别表示运行时间和耗电量的权重,且满足wt+we = I ;T (X, b)和E(X,b)分别表示当前带宽为b时采用程序分割方案X的程序运行时间和耗电量;模型求解空间Xp表示为: [0011] where, TLocal and Ekxal denote run entirely run time and power consumption when the mobile device; wt and We denote the right operating time and power consumption of the heavy, satisfying wt + we = I; T (X , b), and E (X, b) denote the current bandwidth is b with the program run time and power consumption program into program X; the model solution space Xp expressed as:

[0012] Xp ={ζΐ^(Γ,6()<ί^(Α^Λ)χ(1 + «)} [0012] Xp = {ζΐ ^ (Γ, 6 () <ί ^ (Α ^ Λ) χ (1 + «)}

[0013] 其中,带宽阈值Id1为满足条件P(b ^ bx) ^ P。 [0013] wherein the bandwidth threshold Id1 to satisfy the condition P (b ^ bx) ^ P. 的最大带宽值,P。 The maximum bandwidth value, P. 为所设定的概率阈值了为带宽I3l下最优分割方案对应的模型值;a > O为经验常数,用以设定W(X, bx)的上限值为『(%為)x(l + «)。 The set value for the bandwidth is the probability threshold value I3l model corresponding to the optimum segmentation scheme; a> O is an empirical constant, to set the upper limit of W (X, bx) value "(percent) x ( l + «).

[0014] 步骤3,进行带宽自适应程序分割,在节点个数η不超过200时,采用基于深度优先搜索策略的分支定界程序分割方法寻找最优分割方案,在节点个数η大于200时,采用基于最小割的贪心方法(MCGAP)来寻找最优分割方案。 [0014] Step 3, bandwidth adaptive program is divided in number of nodes η does not exceed 200 by the segmentation method to find optimal partitioning scheme based on branch and bound depth first search strategy of the program, in the number of nodes is greater than 200 η , based on minimum cut of greedy method (MCGAP) to find the optimal segmentation scheme.

[0015] 所述的分支定界程序分割方法基于分支定界深度优先搜索法,深度搜索的约束条件包括: [0015] The branch and bound program segmentation based on branch and bound constraints depth-first search, depth of search, including:

[0016] I)程序分割方案在当前带宽b下对应的优化模型值小于当前保存的优化模型的最小值;2)程序分割方案在带宽阈值Id1下的模型目标值不高于所设定模型上限值 [0016] I) program into the program in the current bandwidth b corresponding optimization model smaller than the minimum current saved optimization model; 2) program into the program model in the bandwidth threshold target Id1 is not higher than the set model limit

咖;'έ;)χ(1 + ίΙ)0 Coffee; 'έ;) χ (1 + ίΙ) 0

[0017] 所述的基于最小割的贪心方法,利用Stoer-Wagner最小割算法求得带宽为b和bx时对应的运行在移动设备的节点集合Cb和运行在服务器端的节点集合^,令待分割节点W-Cb -Sbi,对V'中节点进行分割,采用Stoer-Wagner最小割算法中的最大邻接值排序算法对节点进行排序,然后基于贪心策略,同时根据与分支定界程序分割方法中相同的深度搜索的约束条件选取最优分割方案。 [0017] The greedy method based on minimum cut, the use of Stoer-Wagner minimum cut algorithm to obtain the bandwidth b and bx run when the node corresponding set of Cb and mobile devices running on the server node set ^, so be segmented node W-Cb -Sbi, for V 'in the node segmentation using Stoer-Wagner minimum cut algorithm sorting algorithm maximum value adjacent to sort nodes and greedy strategies, while the same program in accordance with the branch and bound method Segmentation constraints depth search of selecting optimal partitioning scheme.

[0018] 步骤4,根据步骤3求得的最优分割方案,实现程序在移动设备和服务器间的代码迁移和分布式执行,有效降低应用程序的执行时间和移动设备的耗电量,延长移动设备的电池使用寿命。 [0018] Step 4. Step 3 obtained optimal partitioning programs to achieve program code migration between mobile devices and servers and distributed execution, execution time and reduce power consumption of mobile device applications, to extend mobile device's battery life.

[0019] 本发明的优点与积极效果在于:(I)采用静态与动态程序分析相结合的方法构造程序的加权对象关系图,所构建的对象关系图复杂度低,并能够准确地反映程序结构,有利于程序分割,适用于资源有限的移动平台;(2)将移动环境中带宽作为一个变量,建立基于运行时间和耗电量的程序分割优化模型,适用于带宽变化的移动环境;(3)基于加权对象关系图和程序分割优化模型,提出了两种带宽自适应的程序分割方法:分支定界程序分割法和基于最小割的贪心方法,前者能够求出小规模程序分割的最优解,后者可快速求得大规模程序分割的近似最优解;两种方法能够适应带宽变化,有效缩短程序运行时间,降低移动设备的能量消耗。 [0019] advantages of the present invention and the positive effect that: (I) the weighted object graph of static and dynamic program analysis method of combining the structure of the program, the low complexity of the object graph constructed, and can accurately reflect the structure of the program conducive segmentation program for resource-constrained mobile platforms; (2) as a variable bandwidth mobile environment, the establishment of segmentation model based on the running time and the power consumption of the program, for bandwidth-changing mobile environment; (3 ) based on a weighted object graph and program segmentation optimization model proposes two adaptive bandwidth segmentation program: Branch and Bound program into law and based on minimum cut greedy method, the former can be the optimal solution for small-scale program segmentation which can quickly obtain the approximate optimal solution of large-scale program segmentation; two ways to adapt to bandwidth changes, shorten the run time, reduce the energy consumption of mobile devices.

附图说明 Brief Description

[0020] 图I为本发明的带宽自适应程序分割流程图; [0020] The bandwidth of the adaptive program chart I split flow chart of the present invention;

[0021] 图2为本发明的示例程序图; [0021] FIG. 2 is a schematic diagram of an example of the program;

[0022] 图3为本发明的示例程序初始对象关系图; [0022] 3 is an example of the program's initial object graph;

[0023] 图4为本发明的示例程序加权对象关系图; The sample program weighted object graph [0023] FIG. 4 of the present invention;

[0024] 图5为本发明的BBAP方法伪代码示意图; BBAP method of pseudo code [0024] Figure 5 is a schematic diagram of the invention;

[0025] 图6为本发明的MCGAP方法伪代码示意图; MCGAP method of pseudo code [0025] Figure 6 is a schematic diagram of the invention;

[0026] 图7为采用三种方法构造加权对象关系图的大小比较示意图; [0026] FIG. 7 is constructed using the size of the three methods of comparison of weighted objects schematic diagram;

[0027] 图8为本发明实施例中程序实际运行时间与三种方法的预测运行时间的对比示意图; [0027] FIG. 8 embodiment the present invention, the actual running time of the program run time prediction of the three methods of comparative schematic illustration;

[0028] 图9为本发明的仿真实验参数示意图; Simulation parameters [0028] FIG. 9 is a schematic diagram of the invention;

[0029] 图10为本发明的仿真实验加权对象关系图信息; [0029] FIG. 10 of the present invention simulations weighted object graph information;

[0030] 图11为本发明的BBAP方法对目标模型三种特殊情况的求解分割时间对比图; BBAP method [0030] FIG. 11 of the present invention to the special circumstances of the three target model for solving split time comparison chart;

[0031] 图12为本发明的BBAP方法的分割结果在不同带宽下对应的运行时间对比示意图; [0031] The method of segmentation BBAP 12 of the present invention at different bandwidths corresponding schematic comparison of the running time;

[0032] 图13为本发明的BBAP方法的分割结果在不同带宽下对应的耗电量对比示意图; Compare segmentation BBAP method [0032] FIG. 13 of the present invention in a schematic view of different bandwidths corresponding power consumption;

[0033] 图14为本发明的BBAP方法的分割结果在不同带宽下对应的加权模型值对比示意图; Compare segmentation result [0033] FIG. 14 BBAP method of the present invention under different bandwidths corresponding weighted schematic model values;

[0034] 图15为本发明的MCGAP方法对目标模型三种特殊情况的求解分割时间对比图; MCGAP method [0034] FIG. 15 of the present invention to the special circumstances of the three target model for solving split time comparison chart;

[0035] 图16为本发明的BBAP与MGCAP运行时间最优模型求解结果对比图; BBAP and MGCAP uptime best model [0035] FIG. 16 of the present invention to solve the result of the comparison chart;

[0036] 图17为本发明的MCGAP方法的分割结果在不同带宽下对应的运行时间对比示意图; MCGAP segmentation method [0036] FIG. 17 of the present invention at different bandwidths corresponding schematic comparison of the running time;

[0037] 图18为本发明的MCGAP方法的分割结果在不同带宽下对应的耗电量对比示意图; Compare segmentation MCGAP method [0037] FIG. 18 of the present invention in a schematic view of different bandwidths corresponding power consumption;

[0038] 图19为本发明的MCGAP方法的分割结果在不同带宽下对应的加权模型值对比示意图;[0039] 图20为本发明的BBAP与MGCAP的平均性能对比图。 MCGAP segmentation method [0038] FIG. 19 of the present invention at different bandwidths corresponding schematic comparison of the weighted value of the model; [0039] BBAP and MGCAP average performance comparison chart 20 of the present invention.

具体实施方式 DETAILED DESCRIPTION

[0040] 下面将结合附图和实例对本发明作进一步的详细说明。 [0040] The accompanying drawings and the following examples of the present invention will be further described in detail.

[0041] 本发明提出的一种基于带宽自适应代码迁移的移动设备节能方法,首先,采用静态与动态分析相结合的方法分析移动应用程序,并构造其对应的加权对象关系图;其次,将移动环境中变化的带宽作为一个变量,建立基于运行时间和耗电量的程序分割优化模型;然后,基于对象关系图和程序分割模型实现带宽自适应的程序分割方法;最后,根据分割结果实现程序在移动设备和服务器间的代码迁移和分布式执行,从而降低应用程序的执行时间和移动设备的耗电量,延长移动设备电池的使用寿命,而且应用程序的运行时间和耗电量随带宽变化波动较小,对带宽变化具有一定的适应性。 [0041] The present invention provides an adaptive bandwidth based on code migration of mobile devices saving method, first using a combination of static and dynamic analysis method to analyze mobile applications, and construct the corresponding weighted object graph; Secondly, bandwidth mobile environments change as a variable to establish segmentation model based on the running time and the power consumption of the program; then, based on the object model diagrams and procedures to achieve the bandwidth adaptive segmentation program segmentation; and finally, implement procedures based on segmentation results code migration and distributed execution between mobile devices and servers, thereby reducing the execution time and power consumption of mobile devices applications extend the battery life of mobile devices, and applications running time and power consumption with the bandwidth changes less volatile, bandwidth change has a certain flexibility. 如图I所示,本发明的移动设备节能方法,具体过程如下: [0042] 步骤I,构造加权对象关系图。 Figure I shows, the mobile device saving method of the present invention, the specific process is as follows: [0042] Step I, construct a weighted object graph.

[0043] 本发明实施例以一个Java程序为例来阐述加权对象关系图的构造过程,示例程序如图2所不,程序包含四个类:FacePreview、ImageCapture> FaceDetection和FaceDetectionLib,其中FacePreview 类的main 方法中创建了一个ImageCapture 对象和两个FaceDetection对象,而两个FaceDetection对象均在执行自身DetectFace方法时调用了FaceDetectionLib类的ProcessBlock方法。 [0043] No, the program contains embodiment of the invention with a Java program as an example to illustrate the weighted object graph construction process, the example program in Figure 2 four classes: FacePreview, ImageCapture> FaceDetection and FaceDetectionLib, which FacePreview class main The method creates an object and two FaceDetection ImageCapture objects, while the two FaceDetection objects are in the implementation method calls itself DetectFace ProcessBlock method FaceDetectionLib class. 首先,进行静态程序分析,利用指向分析(Points-to)技术分析Java程序的字节码文件,得到其方法调用关系图,并通过遍历调用关系图获取程序的所有对象及对象间的调用关系,从而构造出程序的初始对象关系图(I0RG),其节点和边分别对应应用程序的对象和对象间的调用关系。 First, static program analysis by point analysis (Points-to) Technical Analysis Java byte code file program, obtain its method call graph and call to get all the objects and object-relationship between the call graph by traversing, thereby constructing a program of initial object graph (I0RG), its nodes and edges corresponding to the application calling relationships between objects and objects. 图3表示为示例程序对应的初始对象关系图,S_FacePreview创建对象D_ImageCapture、D_FaceDetectionl 和D_FaceDetection2,对象D_FaceDetectionl 和D_FaceDetection2 都调用S_FaceDetectionLib的方法,其中S和D前缀分别表示静态对象和动态对象。 Figure 3 shows a sample program for the corresponding initial object graph, S_FacePreview create objects D_ImageCapture, D_FaceDetectionl and D_FaceDetection2, objects D_FaceDetectionl and D_FaceDetection2 are calling S_FaceDetectionLib, wherein S and D prefix denote static and dynamic objects. 由于节点间的交互主要以方法调用的方式体现,其通信数据主要表现为方法调用的参数及返回值,在动态程序分析阶段,利用Java字节码重写技术,可以获得程序IORG中每个节点对象的CPU运行时间以及每条边(对象间的调用关系)的通信数据量,即加权对象关系图中各节点与边的权值。 Due to the interaction between nodes mainly reflected in the manner of method calls, parameters and return values of the communication data mainly for method invocation, the dynamic program analysis phase, the use of Java byte code rewriting, you can get the program for each node IORG CPU running time traffic data objects, and each edge (call relationships between objects), that is the weight of each node and edge weighting diagram objects. 图4表示为示例程序对应的加权对象关系图,例如节点S-FacePreview所代表的对象的CPU运行时间为50ms,节点S_FacePreview与节点D_ImageCaptur之间的通信数据量为9066bytes。 Figure 4 shows a sample program for the weighting corresponding object graph, such as CPU time node S-FacePreview represented object is 50ms, traffic data nodes and node D_ImageCaptur S_FacePreview between the 9066bytes.

[0044] 步骤2,建立程序分割优化模型。 [0044] Step 2, establish procedures segmentation optimization model.

[0045] 考虑到移动环境中带宽的变化,本发明将带宽作为一个变量,提出基于运行时间和耗电量的程序分割优化模型,令Xi标识节点i的运行位置,Xi=I和Xi=O分别表示节点i在移动设备和服务器端运行,则程序分割方案可表示为X= Ix1, X2,…,xj,b表示当前带宽,J表示最优程序分割方案。 [0045] Taking into account the changes in the mobile environment, the bandwidth, the present invention is a variable bandwidth as proposed segmentation model based on the running time and power consumption of the program, so that the operating position identifies the node i Xi, Xi = I and Xi = O i denote the node in the mobile device and the server is running, the program segmentation scheme can be expressed as X = Ix1, X2, ..., xj, b represents the current bandwidth, J represents the optimal program segmentation scheme. 程序分割优化模型的目标在于求得最优分割方案I,满足i = argSS『u'6),XP表示模型求解空间,W(X,b)表示当前带宽为b时分割方案X的优化模型,具体定义如下: Program segmentation optimization model aims to find an optimum partitioning scheme I, meet i = argSS "u'6), XP represents the model solution space, W (X, b) represents optimization model program X is divided current bandwidth is b, defined as follows:

[0046] W(X,b) =WtXT(X,b)/TLocal+weXE(X,b)/ELocal [0046] W (X, b) = WtXT (X, b) / TLocal + weXE (X, b) / ELocal

[0047] 其中,TLocal和Ekxal分别表示程序全部运行在移动设备时的运行时间和耗电量;wt和We分别表示运行时间和耗电量的权重,且满足wt+we = I ;Τ (X, b)和E(X,b)分别表示当前带宽为b时采用程序分割方案X的程序运行时间和耗电量;模型求解空间Xp表示为: [0047] where, TLocal and Ekxal denote run entirely run time and power consumption when the mobile device; wt and We denote the right operating time and power consumption of the heavy, satisfying wt + we = I; Τ (X , b), and E (X, b) denote the current bandwidth is b with the program run time and power consumption program into program X; the model solution space Xp expressed as:

[0048] [0048]

Figure CN102968173AD00081

[0049] 其中,带宽阈值Id1为满足概率P(b彡Id1)彡P。 [0049] wherein, in order to meet bandwidth threshold Id1 probability P (b San Id1) San P. 的最大带宽值,P。 The maximum bandwidth value, P. 为概率阈值,主要根据无线移动环境中的带宽变化情况具体设定,本发明的实施实验中设定P。 The probability threshold, the main set according to the specific bandwidth in a wireless mobile environment changes, the experimental embodiment of the present invention is set P. 为O. 85。 As O. 85.

为带宽卜下最优分割方案L对应的优化模型值;a为经验常数,用以设定W (Ib1) L corresponding to the value of the bandwidth optimization model for the optimal partitioning scheme Bu; a is an empirical constant for setting W (Ib1)

的上限值为》+ ,其中a的优选值与具体应用程序及其移动环境有关,本发明设 The upper limit is "+, where a preferred value of specific applications and their mobile environment, the present invention is provided

定的优选范围为O < a < 1,本发明中根据对具体应用程序的实验测试,该参数的优选值为a = O. 4。 Given preferred range of O <a <1, the present invention is based on the application-specific laboratory tests, it is preferable that the parameter is a = O. 4.

[0050] 带宽为b时采用程序分割方案X的程序运行时间T(X,b)表示如下: [0050] b use the program when bandwidth segmentation scheme X program run time T (X, b) as follows:

[0051 ] [0051]

Figure CN102968173AD00082

[0052] 其中,tnli与tnsi分别表示节点i在移动设备与服务器端的运行时间,节点i在移动设备的运行时间tnli在动态分析阶段可以得到,即节点i的权重,设服务器计算速度是移动设备的k倍,则: [0052] where, tnli and tnsi represent the node i at run time the mobile device and the server, node i at runtime for mobile devices tnli can get in dynamic analysis phase, the node i weights located server computing speed is a mobile device k times, then:

[0053] [0053]

Figure CN102968173AD00083

[0054] Wij表示在不同位置(移动设备或服务器)执行的节点i与节点j的通信数据量,则带宽为b时节点i,j间数据传输时间为: [0054] Wij represented in different locations (mobile device or a server) traffic data node i to node j is performed, the bandwidth of the node b i, j between the data transmission time is:

[0055] [0055]

Figure CN102968173AD00084

[0056] 带宽为b时米用程序分割方案X的程序耗电量E (X,b)表不为: [0056] bandwidth applications when b m X program segmentation scheme consumption E (X, b) the table is not:

[0057] [0057]

Figure CN102968173AD00085

[0058] 其中,Ei表示节点i在移动设备上执行的耗电量,Eij表示节点i, j之间数据通信的耗电量;令Pepu表示移动设备的CPU功率。 [0058] where, Ei represents the power consumption of the node i on the mobile device performed, Eij represents consumption data communication between nodes i, j; and so Pepu indicates CPU power of the mobile device. 一般情况下,移动设备WiFi接口的接收功率与发送功率差别较小,均表示为数据通信功率Pw,则有: In general, the difference between the received power and the transmission power small mobile devices WiFi interface, are represented as data communication power Pw, there are:

[0059] [0059]

Figure CN102968173AD00086

[0060] [0060]

[0061]由 于 贝IJ ψ(χ^)<ψ{Χζ\δ,)χ(ΐ+α)ο 若b > bp 贝Ijw(x,b)<w(l:h)mx^ D1 ^ +)又由于P(I3Sb1)彡Pc,因此在目标模型中最优分割方案歹满足: [0061] Since the shell IJ ψ (χ ^) <ψ {Χζ \ δ,) χ (ΐ + α) ο If b> bp Tony Ijw (x, b) <w (l: h) mx ^ D1 ^ +) Also, because the P (I3Sb1) San Pc, and therefore the target model bad optimal partitioning scheme met:

[0062] [0062]

[0063] 这说明所求最优分割方案在带宽变化情况下能够以概率P。 [0063] This shows that the optimum partition scheme required bandwidth changes in circumstances can the probability P. 使所对应优化模型的值满足求解空间Xp的阈值限制条件。 So that the value of the corresponding optimization model to solve the space Xp meet the threshold limits.

[0064] 该模型中运行时间和耗电量的权重可以由用户根据移动设备剩余电量和对程序响应时间的需求灵活设定。 [0064] right in the model run time and power consumption can be flexibly re-set by the user according to the needs of the remaining power of mobile devices and application response time. 特别地,当Wt = I和W6 = O时,即对应运行时间最优模型;当Wt=O和We = I时,即为耗电量最优模型。 In particular, when Wt = I and W6 = O, that correspond to the optimal model run time; when Wt = O and We = I, the power consumption is the best model.

[0065] 步骤3,进行带宽自适应程序分割。 [0065] Step 3, bandwidth adaptive segmentation program.

[0066] 在上述加权对象关系图和程序分割优化模型的基础上,首先,基于深度优先搜索策略,提出分支定界程序分割方法(BBAP),深度搜索的约束条件不仅满足分割方案在当前带宽下对应的优化模型值小于当前保存的最小优化模型值,同时还需保证此分割在带宽阈值h下的模型值不高于所设定的优化模型的上限值,从而避免所选分割方案在带宽较低时开销过大,实现对带宽变化的适应性。 [0066] In the weighting object graph and optimization program is divided on the basis of the model, first of all, based on the depth-first search strategy, branch and bound procedure proposed segmentation method (BBAP), constraints depth search of not only meet the current bandwidth partitioning scheme corresponding optimization model optimization model is smaller than the minimum value currently stored, is also required to ensure that this split in the bandwidth threshold h model value is not higher than the upper limit set by the optimization model, thus avoiding segmentation scheme selected bandwidth lower overhead is too large to achieve the bandwidth adaptability to change. 但由于在最坏情况下方法时间复杂度为0(2η) (η为节点个数),该方法不适用于对象(节点数)较多规模较大的应用程序,在本发明的实验平台下当移动应用程序对应的对象节点数大于200时,该方法计算程序分割的求解时间会明显增加。 However, due to the method in the worst case time complexity is 0 (2η) (η is the number of nodes), which does not apply to objects (nodes) more large-scale applications, under the experimental platform of the present invention. When the mobile application corresponding object larger than 200 nodes, the method of calculating program segmentation solution time will be significantly increased. 为此,本发明针对大规模应用程序,从贪心策略考虑提出启发式的基于最小割的贪心方法(MCGAP)。 To this end, the present invention is directed to large-scale applications, from greedy heuristic based strategies to consider making minimum cut of greedy method (MCGAP). MCGAP方法采用最小割Stoer-Wagner方法中用到的最大邻接值排序方法对对象节点进行排序,以BBAP方法中的约束条件为限制,基于贪心策略快速解得程序分割方案。 Methods MCGAP minimum cut Stoer-Wagner method used in the adjacent maximum value sort method to sort of object nodes to BBAP process constraints as limiting, fast and solving program segmentation scheme based on greedy strategy.

[0067] 本发明从搜索策略和贪心策略考虑,提出分别适用于小规模和大规模应用程序分割的分支定界程序分割法(BBAP)和基于最小割的贪心方法(MCGAP),其伪代码分别如图5,图6所示,其中输入主要包括当前带宽b、带宽阈值b1;以及程序对应的加权对象关系图WORG= (V, E,Wv,We),V、E、Wv和We分别表示节点集合、边集合、节点权重集合和边权重集合;输出为程序的最优分割方案和优化模型对应的值。 [0067] The present invention from the search strategy and greedy policy considerations raised were applied to small-scale and large-scale applications split the program into the branch and bound method (BBAP) and based on minimal cut of the greedy method (MCGAP), which are pseudo-code Figure 5, Figure 6, wherein the input includes current bandwidth b, bandwidth threshold b1; and a program corresponding to a weighted object graph WORG = (V, E, Wv, We), V, E, Wv, and We represent node set, edge set, node weight and weight set of edges set right; the optimal output for the program, and optimal partitioning scheme corresponding value.

[0068] 如图5所示,BBAP方法的第I和2行伪代码首先采用Stoer-Wagner静态方法求解带宽为h时的最优分割方案对应的优化模型的值minV_SW,并设定Id1带宽下优化模型值的上限值minV。 [0068] FIG. 5, the first and second row I pseudocode BBAP method first used Stoer-Wagner static method for solving the optimal bandwidth value minV_SW segmentation scheme h when the corresponding optimization model and set Id1 bandwidth Optimization of the upper limit minV model values. 第3行初始化所要求解的优化模型最优值minValue为一个所能表示的最大整数。 3rd row initialization required optimization model for optimal solution value minValue a maximum integer that can be represented. 队表示必须在本地移动设备上执行的节点集合,如与用户交互的接口对象等节点,第4-8行BBAP方法将必须运行在本地移动设备的节点标记为“Xi=l”,V中不属于队的节点都属于待分割节点,待分割节点标记为“Xi=_l”。 Team represents node must be performed on the local mobile device collection, such as interaction with the user interface objects peers, 4-8 line BBAP method will be run in the local mobile device node labeled "Xi = l", V does not nodes belonging to the team are all to be split node, to be split node labeled "Xi = _l". 第9行BBSearch函数基于基本的分支定界法,采用深度优先搜索法求得模型的最优解,每次迭代中均将当前的解空间分成两个子空间Ui=O表示该节点在服务器执行;Xi=l表示该节点在本地移动设备上执行),并采用剪枝策略进行方法优化;BBSearCh中的约束条件不仅满足分割方案在当前带宽下对应的优化模型的值小于当前保存的模型最小值(minValue),同时还需保证此分割在带宽阈值卜下的优化模型的值不高于所设定的模型阈值(minV),从而避免分割方案在带宽较低时开销过大,保证对带宽变化的适应性。 Line 9 BBSearch function is based on the basic branch and bound method, using a depth-first search of the optimal solution obtained model, each iteration in both the current solution space into two subspaces Ui = O indicates that the node execution on the server; Xi = l indicates that the node is executed on the local mobile device), and a pruning method optimization strategy; BBSearCh not only to meet the constraints of the current segmentation scheme in value corresponding bandwidth optimization model is smaller than the minimum value of the current model saved ( minValue), is also required to ensure that this segmentation bandwidth threshold value optimization model BU under the model is not higher than the set threshold (minV), thus avoiding the overhead of segmentation scheme is too large at low bandwidth to ensure that bandwidth changes adaptability. 最后BBAP方法的第10行返回程序的最优分割方案Xmin和优化模型对应的最优值minValue。 Line 10 method will return the last BBAP optimal partitioning scheme Xmin and optimization model corresponding optimal value minValue. 最坏情况下BBAP方法时间复杂度为0(2n),当应用程序对象节点数较多时,计算复杂度较高,因此该方法不适用于规模较大应用程序的分割。 BBAP method worst case time complexity is 0 (2n), when the application object more nodes, high computational complexity, so this method is not suitable for large-scale applications split.

[0069] 由于带宽越高,数据传输开销越低,因此,带宽较高情况下运行于移动设备的节点在带宽降低时将仍运行于移动设备,而带宽较低情况下运行于服务器的节点在带宽升高时将仍运行于服务器。 [0069] Due to the higher bandwidth and lower data transmission overhead, so, in the case of high-bandwidth nodes running on mobile devices at lower bandwidth will still run on mobile devices, while the bandwidth lower case node running on the server in the will still run on the server bandwidth is increased. 记Xb = (Cb, Sb)表示带宽b下对应的程序最优分割方案,Cb和Sb分别表示带宽为b时运行在移动设备和服务器端的节点集合,对于某个带宽B下对应的程序最优分割方案Xb = (CB,SB),有:,(2)5>6 = S4 eLMCGAP 方法中,考虑在b与Id1间变化的带宽,设S = (H,)为模型最优解,则有Qe Remember Xb = (Cb, Sb) b represents the bandwidth corresponding to the optimal partitioning scheme program, Cb and Sb represent the bandwidth is b running on Node mobile devices and server-side collection, under certain bandwidth B for the corresponding program Best segmentation scheme Xb = (CB, SB), has:, (2) 5> 6 = S4 eLMCGAP method in consideration of variation between the bandwidth b and Id1, set S = (H,) for the optimal solution, there are Qe

[0070] 如图6所示,MCGAP方法首先在第I行代码中将所要求解的优化模型最优值minValue初始化为一个所能表示的最大整数。 As shown in [0070] As shown 6, MCGAP method first article I will be in the line of code optimization model solution of the desired optimum value minValue initialized to a maximum integer that can be represented. 第2-4行根据Stoer-Wagner方法分别求得静态带宽b和Id1下的最优程序分割方案(Cb,Sb)和,并根据对应的优化模型最优值设定带宽K下优化模型值的上限值Wbl。 2-4 rows as Stoer-Wagner method to get the optimal procedures were static bandwidth b and Id1 lower division program (Cb, Sb) and, in accordance with the corresponding optimization model for optimal value optimization model values of the set bandwidth K the upper limit Wbl. MCGAP方法中第5-6行的Adjust函数根据Stoer-Wagner方法所求得的Cb和\调整程序的加权对象关系图,并确定待分割节点V',F' = F-C6-&,即当带宽在bjPb间变化时只需决策V'中节点的分割,以减小计算量。 Adjust function MCGAP process lines 5-6 Stoer-Wagner method according to the obtained Cb and \ adjust procedures weighted object graph and determine to be split node V ', F' = F-C6- &, that is, when Bandwidth simply split decision V 'in the node bjPb change in time, to reduce the amount of calculation. 第7-18行即基于最小割求解程序的最优分割方案,其中第8行MA_0rder函数采用最小割Stoer-Wagner方法中的最大邻接值排序方法对节点进行排序;第9_11行基于贪心策略确定当前选择的分割方案(C,S),C和S分别表示当前分割中运行在本地移动设备和服务器的节点集合,并计算此方案在带宽!^和、下对应的优化模型值Wb (C,S)和Wbl (C,S);第12-15行根据与BBAP中相同的两个约束条件:Wbl(C,S) <ffbl和Wb(C,S)〈minValue,其中Wbl表示带宽卜下程序分割优化模型的上限值,更新当前最优分割方案(Cmin,Smin);第16-17行Contract函数是将Vnrl和Vm两个节点合并,并从节点集合V'中删除节点Vm,其中A3=Contract (A1, A2)具体表示删除两个节点A1和A2,生成一个新节点A3,并对于图中其他任意节点V,建立新边e= (A3, V),更新其权重:w (A3, V) = w (A1, v) +w (A2, v)。 7-18 line that is based on minimal cut solver optimal partitioning scheme, where the first 8 rows MA_0rder function with a minimum cut Stoer-Wagner method maximum value adjacent nodes sorting method for sorting; the first 9_11 greedy strategy based on determining a current row Select the partitioning scheme (C, S), C and S, respectively, the current split in the local node running on a collection of mobile devices and servers, and compute this program in terms of bandwidth! ^ and, under optimal model corresponding value Wb (C, S ) and Wbl (C, S); 12-15 rows as the BBAP same two constraints: Wbl (C, S) <ffbl and Wb (C, S) <minValue, which indicates the bandwidth BU Wbl under program dividing the upper limit of the optimization model, to update the current optimal partitioning scheme (Cmin, Smin); 16-17 rows Contract function is to merge Vnrl and Vm two nodes, and from the node set V 'to remove a node Vm, where A3 = Contract (A1, A2) specific means to delete two nodes A1 and A2, to generate a new node A3, and the figure for any other node V, establish a new edge e = (A3, V), update their weights: w (A3 , V) = w (A1, v) + w (A2, v). 最后MCGAP方法的第19行返回程序的最终最优分割方案(Cmin,Smin)和优化模型对应的最优值minValue。 Line 19 method will return the last MCGAP final optimal partitioning scheme (Cmin, Smin) and optimization model corresponding optimal value minValue.

[0071] 步骤4,分布式执行程序。 [0071] Step 4, distributed execution.

[0072] 最后根据程序分割方法解得的最优分割方案,实现程序在移动设备和服务器间的代码迁移和分布式执行,可以有效降低应用程序的执行时间和移动设备的耗电量,延长移动设备的电池使用寿命。 [0072] Finally, according to the program segmentation solve for the optimal segmentation programs to achieve program code migration between mobile devices and servers and distributed execution, the execution time can reduce power consumption and mobile device applications, to extend mobile device's battery life.

[0073] 下面将结合附图说明本发明提出的基于带宽自适应程序分割的移动设备节能方法相比其他方法的改进效果。 [0073] The following description of the accompanying drawings of the present invention proposes a mobile device based on energy saving compared to the bandwidth of the adaptive program into effect of improving other methods. 首先为了分析本发明的加权对象关系图构造方法性能,实施平台采用内存为3. 0GB, CPU频率为2. 53GHz,运行Ubuntu 10. 10操作系统的ThinkPadX201i笔记本。 First, in order to analyze the weighted object graph performance of the present invention constructor, the implementation platform memory 3. 0GB, CPU frequency of 2. 53GHz, running Ubuntu 10. 10 operating system ThinkPadX201i notebook. 利用Java字节码分析与优化框架Soot工具和字节码重写技术,针对DacapoBenchmarks程序,将本发明的加权对象关系图构造方法(CSDPAC)与纯静态分析方法(PSPAC)、纯动态分析方法(PDPAC)进行对比。 The use of Java byte code analysis and optimization framework Soot tools and bytecode rewriting technology for DacapoBenchmarks program, weighted object graph constructor (CSDPAC) of the present invention and pure static analysis methods (PSPAC), pure dynamic analysis ( PDPAC) were compared. 图7和图8都是执行8个示例程序(Programs )来进ίΐ对t匕,分别是:avrora, h2, luindex, lusearch, pmd, sunf low, tomcat 和xalan。 Figures 7 and 8 are executed eight sample program (Programs) to enter ίΐ for t dagger, namely: avrora, h2, luindex, lusearch, pmd, sunf low, tomcat and xalan.

[0074] 图7表示三种方法所获取对象关系图的大小比较。 [0074] Figure 7 shows a size comparison object graph of the three methods to obtain. 从图7可以看出,与I3DPAC相t匕,CSDPAC与PSPAC所构造的加权对象关系图规模较小。 As can be seen from Figure 7, and I3DPAC phase t dagger, small CSDPAC constructed with PSPAC weighted object graph scale. 这是由于CSDPAC与PSPAC均利用程序的静态信息删除系统库对象,对初始程序对象关系图进行裁剪,而roPAc记录了包括系统库对象及其关系等所有运行时信息,对象关系图规模较大。 This is due to CSDPAC PSPAC utilize static information and delete system libraries target program, the initial program object graph crop, and roPAc record includes all runtime information, object graph larger system library objects and their relationships.

[0075] 图8表示程序实际运行时间与三种方法下预测运行时间的对比。 [0075] Figure 8 shows a comparison of the running time of the program predict the actual running time of three methods. 实验根据程序总字节码数(Bytecode Instruction Count,简称BIC)来预测程序的运行时间。 Experimental procedure based on the total number of bytes of code (Bytecode Instruction Count, referred BIC) to predict the run-time program. 预测运行时间(Predicted Execution Time,简称PET)与实际运行时间(Actual Execution Time,简称AET)越接近,表明所构造对象关系图越准确。 Predict running time (Predicted Execution Time, abbreviated PET) with the actual running time (Actual Execution Time, referred AET) closer, the more accurate the constructed object graph. 从图8可以看出,CSDPAC和TOPAC的预测运行时间都比较接近于程序实际运行时间,表明动态分析能够获得较为准确的程序运行时信息。 As can be seen from Figure 8, CSDPAC and TOPAC predicted run time are relatively close to the actual running time of the program, indicating that dynamic analysis can obtain more accurate information about the program is running. 而PSPAC只采用静态程序分析,无法精确获取程序运行时信息,因此预测运行时间偏小,表明PSPAC所获取对象关系图不够准确。 The PSPAC only static program analysis, the program runs can not be accurately get information, so predicting the running time is small, indicating that the acquired object graph PSPAC inaccurate. 由图7和图8可以看出,CSDPAC结合了TOPAC和PSPAC的优点,既能获得较准确的程序信息,又能避免对象关系图规模较大,减轻移动应用程序分割的计算负担。 As can be seen from Figure 7 and Figure 8, CSDPAC combines the advantages TOPAC and PSPAC, both to obtain a more accurate program information, but also to avoid a large object graph scale, reduce the computational load of the mobile application division.

[0076] 为评价本发明的BBAP与MCGAP方法的性能,实施平台采用内存为3. 0GB, CPU频率为2. 53GHz,运行Windows 7操作系统的ThinkPad Χ201Ϊ笔记本。 [0076] In order to evaluate the performance of BBAP and MCGAP method of the present invention, the implementation platform memory 3. 0GB, CPU frequency of 2. 53GHz, running Windows 7 operating system ThinkPad Χ201Ϊ notebook. 具体实施参数设置如图9所示,图10为应用程序实例对应的对象关系图中节点个数和边个数。 DETAILED DESCRIPTION parameter settings shown in Figure 9, Figure 10 is the application instance object corresponding diagram node number and the number of edges. 仿真实验针对程序分割模型的三种特殊情况:(l)wt = I, we = O (运行时间最优);(2) Wt = O, We = I (能量最优);(3) Wt = O. 5, We = O. 5,分别实施如下步骤: The simulation model for the program into three special cases: (l) wt = I, we = O (run-time best); (2) Wt = O, We = I (optimal energy); (3) Wt = O. 5, We = O. 5, the following steps are implemented:

[0077] (I)用Stoer-Wagner方法和BBAP/MCGAP方法分别求解带宽IOOkb/s下的最优分割Cut (W,SJi, 100)和Cut (W,BBAP, 100)(或Cut (W,MCGAP, 100));其中S_W 是Stoer-Wagner方法的简称,W表示优化模型; [0077] (I) with Stoer-Wagner method and BBAP / MCGAP Methods for solving the optimal partitioning Cut (W, SJi, 100) and Cut (W, BBAP, 100) (or Cut (W Bandwidth IOOkb / s under MCGAP, 100)); where S_W is referred Stoer-Wagner method, W represents optimization model;

[0078] (2)分别计算以上两个分割Cut(W,S_W,100)与Cut (W,BBAP,100)(或Cut (ff, MCGAP, 100))在不同带宽b 下对应的模型值W{Cut (W,S_W,100),b}、W {Cut (ff, BBAP, 100),b}(或W {Cut (ff, MCGAP, 100), b}); [0078] (2) above were calculated two divided Cut (W, S_W, 100) and Cut (W, BBAP, 100) (or Cut (ff, MCGAP, 100)) at different bandwidths corresponding model values W b {Cut (W, S_W, 100), b}, W {Cut (ff, BBAP, 100), b} (or W {Cut (ff, MCGAP, 100), b});

[0079] (3)用Stoer-Wagner方法依次计算不同带宽b下对应的模型最优值Wmin (b); [0079] (3) Stoer-Wagner method followed by calculation of different bandwidths b corresponding model for optimal value Wmin (b);

[0080] (4)计算程序全部在移动设备上执行对应的模型值WLocal。 [0080] (4) The calculation program fully implemented WLocal corresponding model values on mobile devices.

[0081] 特殊地,为了更加直观,对于(I) wt = I, We = O (运行时间最优)和(2) Wt = O,We= I (能量最优)两种情况,实验结果将模型值等价转化为程序运行时间和耗电量,图中符号表示分别用'T'(Time)和'E'(Energy)代替相应的'W,(Weight),即W{Cut (W,S_ff, 100),b}、W{Cut(W, BBAP, 100),b}(或W {Cut (W,MCGAP, 100),b} )、Wmin (b)和WLocal 在(I)wt = 1,we = O 情况下分别对应表示为T{Cut (T,S ff, 100),b}、T {Cut (T,BBAP, 100), b}(或T {Cut (T, MCGAP, 100),b} )、Tmin (b)和TLocal,在(2) wt = 0,We= I 情况下分别对应表示为E {Cut (E, S_ff, 100),b}、E {Cut (E, BBAP, 100),b}(或E {Cut (E, MCGAP, 100),b} )、Emin (b)和ELocalo [0081] particularly, to a more intuitive, for (I) wt = I, We = O (optimal running time) and (2) Wt = O, We = I (Optimum Energy) in both cases, the results model values into equivalent program run time and power consumption, the figure symbols were used to 'T' (Time) and 'E' (Energy) instead of the corresponding 'W, (Weight), namely W {Cut (W, S_ff, 100), b}, W {Cut (W, BBAP, 100), b} (or W {Cut (W, MCGAP, 100), b}), Wmin (b) and WLocal in (I) wt = 1, under the circumstances we = O respectively denoted as T {Cut (T, S ff, 100), b}, T {Cut (T, BBAP, 100), b} (or T {Cut (T, MCGAP, 100 ), b}), Tmin (b) and TLocal, in (2) wt = 0, We = I under the corresponding conditions are denoted as E {Cut (E, S_ff, 100), b}, E {Cut (E, BBAP, 100), b} (or E {Cut (E, MCGAP, 100), b}), Emin (b) and ELocalo

[0082] 图11表示BBAP方法对目标模型三种特殊情况下的求解时间。 [0082] FIG. 11 shows a method BBAP target model under three special circumstances of the solution time. 图中Model_T、Model_E 和Model_ff 分别对应(I) Wt = I 和We = O ; (2) Wt = O 和We = I ; (3) Wt = O. 5 和we = O. 5三种情况。 Figure Model_T, Model_E and Model_ff respectively (I) Wt = I and We = O; (2) Wt = O and We = I; (3) Wt = O. 5 and we = O. 5 three cases. 可以看出,对于节点个数较少的图,BBAP能够在较短时间内求出最优解;对于节点个数较多的图,其求解时间较长。 As can be seen, the number of nodes in FIG less, BBAP be able to find the optimal solution in a short time; for the larger number of nodes Figure, which solved a long time. 这说明BBAP适用于规模较小的图,而对于节点数较多的图,如对于lusearch程序,BBAP的计算开销明显增大。 This shows BBAP for smaller scale map, but for many nodes Figure, as appropriate for lusearch program, significantly increased computational overhead BBAP.

[0083] 图12、图13和图14分别表示为BBAP与其他方法在带宽变化情况下对应的程序运行时间(wt = I, We = O)、耗电量(Wt = O, We = I)和最优模型值(Wt = O. 5, We = O. 5)的性能对比图。 [0083] FIG. 12, FIG. 13 and FIG. 14 are represented BBAP and other methods in the case of bandwidth changes corresponding program running time (wt = I, We = O), power consumption (Wt = O, We = I) and the optimal model values (Wt = O. 5, We = O. 5) The performance comparison chart. 图12〜14中分别给出了在四个程序的运行对比,四个程序分别是:(A)RandomGraphl 程序,(B) RandomGraph2 程序,(C) lusearch 程序,(D)avrora 程序。 Figure 12~14 in contrast were given to run four programs, four programs are: (A) RandomGraphl program, (B) RandomGraph2 program, (C) lusearch program, (D) avrora program. 在图12中,T {Cut (T, BBAP, 100), b}和T {Cut (T, S_W, 100), b}分别表示带宽为100kb/s 时用BBAP和Stoer-Wagner方法得到的最优分割方案Cut (T, BBAP, 100)和Cut (T, SW,100)在不同带宽b下对应的程序运行时间。 In Figure 12, T {Cut (T, BBAP, 100), b} and T {Cut (T, S_W, 100), b} respectively when bandwidth is 100kb / s with BBAP and Stoer-Wagner obtained the best Excellent segmentation scheme Cut (T, BBAP, 100) and Cut (T, SW, 100) at different bandwidths b corresponding program run time. Tmin (b)表示在每个带宽b下多次用Stoer-Wagner方法求得的最优分割方案对应的最短程序运行时间。 Tmin (b) represent the bandwidth at each b repeatedly calculated by Stoer-Wagner method of optimal partitioning scheme corresponds to the minimum program run time. TLocal表示不采用程序分割,即程序全部在移动设备本地执行的时间。 TLocal said they did not use the program split time that is all the procedures performed locally on the mobile device. 可以看出,T{Cut(T,BBAP,100),b}与Tmin(b)在多数情况下均小于TLocal,而TlCut (T,S_ff, 100), b}在带宽较大情况下也小于TLocal,这说明利用程序分割实现代码迁移,能够有效降低应用程序的运行时间。 As can be seen, T {Cut (T, BBAP, 100), b} and Tmin (b) in most cases less than TLocal, and TlCut (T, S_ff, 100), b} In the case of larger bandwidth is less than TLocal, indicating that the use of the migration program into implementation code, can effectively reduce the run time of the application. 当带宽大幅度下降时,静态程序最优分割Cut (T, S_ff, 100)对应的运行时间T {Cut (T, S_ff, 100),b}急剧增长,随带宽变化波动较大。 When a significant decline in the bandwidth, the static optimal partitioning program Cut (T, S_ff, 100) corresponding to the running time T {Cut (T, S_ff, 100), b} dramatic increase in bandwidth changes with fluctuations. 而T{Cut(T,BBAP,100),b}较接近于不同带宽下的程序最短运行时间Tmin (b),且波动较为平缓。 The T {Cut (T, BBAP, 100), b} closer to the minimum running time for the program under different bandwidths Tmin (b), and the volatility is more gentle. 图13和图14对应的程序耗电量和最优模型值具有类似结论。 Figures 13 and 14 corresponding to the power consumption and the optimum value of the model program with a similar conclusion. 这说明相比静态Stoer-Wagner方法,BBAP能够较好地适应带宽变化,减少应用程序运行时间和耗电量;而与每个不同带宽下均需重新计算分割的动态方法相比,BBAP仅需分割一次,降低了分割开销。 This shows that compared to static Stoer-Wagner method, BBAP can better adapt to bandwidth changes, reduce application run time and power consumption; compared with the bandwidth required at each different dynamic approach to recalculate segmentation, BBAP only a split, the split reduced overhead.

[0084] 图15为MCGAP方法对目标模型三种特殊情况下的求解时间。 [0084] FIG. 15 is a method for solving the time MCGAP three target model under special circumstances. Model_T、Model_E和Model_W分别对应(I) Wt = I和We = O (运行时间最优);(2) Wt = O和We = I (能量最优);(3)wt = 05和~ = 0.5。 Model_T, Model_E and Model_W respectively (I) Wt = I and We = O (run-time best); (2) Wt = O and We = I (optimal energy); (3) wt = 05 and ~ = 0.5 . 与图11比较,可以看出,图节点个数较少时MCGAP方法的求解时间与BBAP方法相差不大;而节点个数较多时MCGAP方法的求解时间明显减少。 Compared with 11, it can be seen, when the number of nodes in FIG less MCGAP method for solving time and BBAP method less; while the number of nodes on MCGAP methods significantly reduce solution time.

[0085] 图16为MCGAP方法与BBAP方法在不同带宽下求解的程序最短运行时间对比图。 [0085] FIG. 16 is MCGAP method BBAP under different bandwidths solving program shortest running time comparison chart. 其中b表示带宽,B、M和P分别表示BBAP、MCGAP方法和MCGAP近似解的精确度。 Where b represents the bandwidth, B, M and P, respectively, accuracy BBAP, MCGAP methods and MCGAP approximate solutions. 设X为BBAP解得的模型最优解,X为采用MCGAP方法求得的近似最优解,则W(X,b)/ iv(xh)为MCGAP方法近似解的精确度。 Let X model BBAP solve for the optimal solution, approximate optimal solution X is obtained using MCGAP method, the accuracy of the W (X, b) / iv (xh) is MCGAP method of approximate solution. 从图16可以看出,MCGAP求解的最短程序运行时间较接近于BBAP对应的最优解,精确度较高,可用于较快地求得规模较大对象关系图的近似最优解。 As it can be seen from Figure 16, the shortest program run time MCGAP closer to solving the optimal solution BBAP corresponding to higher precision, can be used to approximate the optimal solution quickly obtain larger object relational graph.

[0086] 图17、图18和图19分别为MCGAP与其他方法在带宽变化情况下对应的程序运行时间(wt = l,we = O)、耗电量(wt = 0,we = I)和最优模型值(wt = O. 5, We = O. 5)的性能对比图。 [0086] FIGS. 17, 18 and 19 respectively, with other methods MCGAP bandwidth changes in circumstances corresponding program run time (wt = l, we = O), power consumption (wt = 0, we = I) and Optimal model values (wt = O. 5, We = O. 5) The performance comparison chart. 图17〜19中分别给出了在四个程序的运行对比,四个程序分别是:(a) avrora程序,(b) lusearch程序,(c) Iuindex程序,(d)h2程序。 Figure 17~19 in contrast were given to run four programs, four programs are: (a) avrora program, (b) lusearch program, (c) Iuindex program, (d) h2 program. 由图17,图18和图19可以看出,与程序全部运行在移动设备相比,利用程序分割和代码迁移可以降低移动设备的耗电量,缩短应用程序的运行时间;而与静态程序分割Stoer-Wagner方法相比,MCGAP对应的模型目标值较接近于不同带宽下的最小值,随带宽波动较为平缓。 Figure 17, 18 and 19 can be seen in comparison with the program running all mobile devices, the use of program segmentation and code migration can reduce the power consumption of mobile devices to shorten the running time of the application; and static segmentation program Compared Stoer-Wagner, MCGAP corresponding model closer to the minimum target under different bandwidths, with bandwidth of volatility is more gentle. 可见,随着环境中带宽的变化,MCGAP能够避免模型目标值因带宽降低而急剧增加,有效缩短程序运行时间,降低移动设备的耗电量。 Visible, as the environment changes in bandwidth, MCGAP can be avoided by reducing the bandwidth and sharp increase in the target model, effectively shortening the program running time, reducing power consumption of mobile devices. 虽然图中动态方法的性能较好,但BBAP和MCGAP均避免了动态方法在不同带宽下多次计算分割的较大开销。 Although the performance of the drawing dynamic method is better, but BBAP and MCGAP are avoiding large overhead dynamic bandwidth is many times under different computing division. 如果考虑动态方法多次分割的计算开销,其性能将明显下降。 If we consider the dynamic method to calculate the cost of multiple segmentation, its performance will be significantly decreased.

[0087] 图20为BBAP与MCGAP方法的平均性能对比图。 [0087] FIG. 20 is the average performance BBAP and MCGAP method comparison chart. TRl和ERl分别表示与采用Stoer-Wagner方法相比,采用BBAP/MCGAP方法时程序平均运行时间和耗电量降低的百分比;TR2和ER2分别表示与程序全部运行在移动设备相比,采用BBAP或MCGAP方法时程序平均运行时间和耗电量降低的百分比。 TRl and ERl respectively compared with a Stoer-Wagner method using the percentage BBAP / MCGAP method program the average running time and power consumption reduced; TR2 and ER2 respectively, and run entirely on mobile devices compared to using BBAP or The average running time and power consumption reduction method percentage MCGAP program. 可以看出,与程序全部运行在移动设备相比,采用BBAP方法对应的程序平均运行时间和耗电量分别降低了44. 17%和34. 47%,采用MCGAP方法的程序平均运行时间和耗电量分别降低了37. 44%和46. 09% ;而与静态程序分割Stoer-Wagner方法相比,BBAP对应的平均运行时间和耗电量分别降低了26. 38%和25. 88%,MCGAP对应的程序平均运行时间和耗电量分别降低了26. 99%和30. 58%。 As can be seen, and run entirely on mobile devices compared to using BBAP method corresponds to the average running time of the program and the power consumption decreased by 44.17% and 34.47%, using the method of procedure MCGAP average running time and consumption electricity consumption decreased by 37.44% and 46.09%; compared with static program segmentation Stoer-Wagner method, BBAP corresponding average running time and power consumption decreased by 26.38% and 25.88%, MCGAP program corresponding average running time and power consumption decreased by 26.99% and 30.58%.

[0088] 通过以上具体实施实验验证,可以得出,在带宽不断变化的情况下,本发明的基于带宽自适应程序分割和代码迁移的移动设备节能方法,可以有效降低应用程序的执行时间和移动设备的耗电量,从而延长移动设备的电池使用寿命。 [0088] The above experimental verification of specific embodiments, it can be concluded in the case of changing the bandwidth, the bandwidth of the present invention is based on an adaptive segmentation and code migration program of energy saving in a mobile device, can effectively reduce the execution time of applications and mobile power consumption of the device, thus extending battery life for mobile devices.

Citações de patente
Citada Data de depósito Data de publicação Requerente Título
CN101473301A *8 maio 20071 jul. 2009微软公司Iterative static and dynamic software analysis
JPH09179738A * Título indisponível
US5579518 *31 maio 199526 nov. 1996Fuji Xerox Co., Ltd.Message compiler for object-oriented language that statically produces object code by provisionally identifying a set of candidate types
US20100131721 *21 nov. 200827 maio 2010Richard TitleManaging memory to support large-scale interprocedural static analysis for security problems
US20120060142 *1 set. 20118 mar. 2012Code Value Ltd.System and method of cost oriented software profiling
Citações de não patente
Referência
1 *于利前等: "《静动态结合的Java程序不变性分析方法》", 《计算机学报》, vol. 33, no. 4, 30 April 2010 (2010-04-30)
Classificações
Classificação internacionalG06F9/44, G06F1/32
Eventos legais
DataCódigoEventoDescrição
13 mar. 2013C06Publication
24 abr. 2013C10Entry into substantive examination
26 ago. 2015C14Grant of patent or utility model
14 dez. 2016EXPYTermination of patent right or utility model