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 B
Tipo de publicaçãoConcessão
Número do pedidoCN 201210421845
Data de publicação26 ago. 2015
Data de depósito30 out. 2012
Data da prioridade28 set. 2012
Também publicado comoCN102968173A
Número da publicação201210421845.9, CN 102968173 B, CN 102968173B, CN 201210421845, CN-B-102968173, CN102968173 B, CN102968173B, CN201210421845, CN201210421845.9
Inventores牛建伟, 宋文芳
Requerente北京航空航天大学
Exportar citaçãoBiBTeX, EndNote, RefMan
Links externos:  SIPO (escritório de patentes da China), Espacenet
一种基于带宽自适应代码迁移的移动设备节能方法 An energy-saving method of a mobile device based on the bandwidth of the adaptive code migration traduzidas do Chinês
CN 102968173 B
Resumo  traduzidas do Chinês
本发明提出一种基于带宽自适应代码迁移的移动设备节能方法,通过对移动应用程序进行静态和动态分析,构造出一种加权对象关系图,从而将程序分割问题转化为对象关系图分割问题;将移动环境中变化的带宽看作一个变量,提出基于运行时间和能量最优的目标模型;针对程序分割优化模型提出带宽自适应的分支定界程序分割法(BBAP)和基于最小割的贪心程序分割法(MCGAP);最后基于所得到的分割方案实现移动应用程序在移动设备和服务器间的代码迁移和分布式执行。 The present invention proposes a code migration adaptive bandwidth saving method based on mobile devices, mobile applications through static and dynamic analysis, constructs a weighted object graph, so the program is divided problems into object graph partitioning problem; changes in the mobile environment as a variable bandwidth, uptime and energy put forward the goal of optimal model; branch and bound procedure proposed adaptive bandwidth segmentation method (BBAP) based optimization model for the program into the smallest cut greedy program Segmentation (MCGAP); and finally the resulting segmentation scheme for mobile application code migration between mobile devices and server-based and distributed execution. 本发明方法能够有效缩短移动应用程序的运行时间,降低移动设备的电能消耗,并对带宽变化具有良好的适应性。 The method of the present invention can effectively shorten the running time of mobile applications, lower power consumption of mobile devices, and bandwidth variation has good adaptability.
Reivindicações(3)  traduzidas do Chinês
1. 一种基于带宽自适应代码迀移的移动设备节能方法,在移动环境带宽不断变化的情况下,其特征在于,该移动设备节能方法通过下面步骤实现: 步骤1 :构造加权对象关系图,具体是:首先,进行静态程序分析,根据程序的方法调用关系,构造程序初始的对象关系图,对象关系图中的各节点和边分别对应程序中的对象和对象间的调用关系;然后,通过动态程序分析获得对象关系图中各节点对象的运行时间以及每条边的通信数据量,得到加权对象关系图; 步骤2:基于加权对象关系图,将带宽作为一个变量,建立基于运行时间和耗电量的程序分割优化模型,具体是:令Xi标识节点i的运行位置,Xi = 1和Xi= 〇分别表示节点i在移动设备和服务器端运行,程序分割方案表示为X = Ix1, X2,…,χη},η为加权对象关系图中的节点个数,则程序分割优化模型的目标在于求得最优分割方案I,满足I = , Xp为模型求解空间,b表示当前带宽,W(X,b)表示当前带宽为b时程序分割方案X的优化模型,具体定义如下: W (X, b) = wt XT (X, b) /TLocal+we XE (X, b) /Eloc31 其中,1。 A mobile device with adaptive bandwidth saving method based on the code 迀 shift, 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 1: Construct a weighted object graph, Specifically: First, static program analysis, program call relation according to the method, constructor initial object graph, object graph of nodes and edges corresponding to the program calling relationships between objects and object; then, by dynamic program get running time analysis of each node objects, and traffic data for each edge object graph to obtain a weighted object graph; Step 2: Based on weighted object graph, as a variable bandwidth, established based on the operating time and consumption power optimization program segmentation model, specifically: Let Xi identifies a node i running position, Xi = 1 and Xi = billion respectively node i run on mobile devices and server-side 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 the optimal partitioning scheme I, meet I =, Xp as a model to solve the space, b represents the current bandwidth, W ( X, b) indicates that the current program is divided bandwidth b X optimization model program, specifically defined as follows: W (X, b) = wt XT (X, b) / TLocal + we XE (X, b) / Eloc31 wherein, 1. . 31和E ^31分别表示程序全部运行在移动设备的运行时间和耗电量;w ,和we分别表示运行时间和耗电量的权重,且满足Wt+We= 1 ; T (X,b)表示当前带宽为b时采用程序分割方案X的程序运行时间: 31 and E ^ 31 denote programs all run-time and power consumption of mobile devices; w, and we represent the right to re-run time and power consumption, and meet Wt + We = 1; T (X, b) It indicates the current bandwidth is b with the program segmentation scheme X program run time:
Figure CN102968173BC00021
其中,tnli与tnsi分别表示节点i在移动设备与服务器端的运行时间;tnli为加权对象关系图中对应节点i的权重,设服务器计算速度是移动设备的k倍,则:tnsi= tnli/k ;令Wij 表示移动设备与服务器端的通信数据量,则带宽为b时节点i,j间数据传输时间^为:tu =WijZb ; E (X,b)表示当前带宽为b时采用程序分割方案X的程序耗电量: Wherein, tnli and tnsi represent nodes i run time on 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 Wij represents traffic data mobile device and the server side, the bandwidth of node i, j between the data transmission time for the b ^ is: tu = WijZb; E (X, b) represents the use of program segmentation scheme X current bandwidth is b when Program power:
Figure CN102968173BC00022
其中,Ei表示节点i在移动设备上运行的耗电量,E i= t nliXPepu;E u表示节点i,j之间数据传输的耗电量,Eij=示移动设备的CPU功率,Pw表示移动设备WiFi 接口的数据通信功率; 所述的模型求解空间Xp定义为: Wherein, Ei represents the power consumption in node i to run on mobile devices, E i = t nliXPepu; E u represents the node i, j is the power consumption of the data transfer between, Eij = CPU power of the mobile device shown, Pw represents mobile WiFi data communication power device interfaces; Xp defining the solution space model as follows:
Figure CN102968173BC00023
其中,带宽阈值K 为满足概率P (I3^b1)彡P。 Wherein the bandwidth threshold K to satisfy the probability P (I3 ^ b1) San P. 的最大带宽值,P。 The maximum bandwidth value, P. 为所设定的概率阈值;为带宽卜下最优程序分割方案对应的优化模型值;经验常数a > O ; 步骤3 :进行带宽自适应程序分割,在节点个数η不超过200时,采用分支定界程序分割方法寻找最优分割方案,在节点个数η大于200时,采用基于最小割的贪心方法来寻找最优分割方案; 所述的分支定界程序分割方法基于分支定界深度优先搜索法,深度搜索的约束条件包括:1)程序分割方案在当前带宽b下对应的优化模型值小于当前保存的优化模型的最小值;2)程序分割方案在带宽阈值Id 1下的模型目标值不高于所设定模型上限值 To the set probability threshold; split the bandwidth BU program optimization model under optimal value corresponding programs; empirical constant a> O; Step 3: bandwidth adaptive segmentation procedure, when the number of nodes η does not exceed 200, using Branch and Bound program segmentation method to find the optimal segmentation scheme, η 200 is greater than the number of nodes, 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 Constraints search method, the depth of the search include: 1) Program segmentation scheme in the current bandwidth b corresponding optimization model smaller than the minimum current saved optimization model; 2) Program segmentation scheme in bandwidth threshold Id models under target 1 no higher than the upper limit set by model
Figure CN102968173BC00031
所述的基于最小割的贪心方法,利用Stoer-Wagner最小割算法求得静态带宽为b和卜时对应的运行在移动设备的节点集合Cb和运行在服务器端的节点集合&,,令待分割节点F = ,V表示加权对象关系图中的节点集合,对V'中节点进行分割,采用Stoer-Wagner最小割算法中的最大邻接值排序算法对节点进行排序,然后基于贪心策略, 同时根据与分支定界程序分割方法中相同的深度搜索的约束条件选取最优分割方案; 步骤4 :根据得到的最优分割方案,实现程序在移动设备和服务器间的代码迀移和分布式执行。 Based on the minimum cut greedy method, the use of Stoer-Wagner minimum cut algorithm to obtain static bandwidth b and BU run when the corresponding collection of Cb and mobile devices running on the node set in the server node & ,, so be split node F =, V represents a weighted object graph of nodes set on V 'in the node segmentation using Stoer-Wagner minimum cut algorithm for the maximum value of the adjacent node sorting algorithm to sort, and then based on greedy strategy, and according to the branch delimitation of the same program segmentation constraints select the optimal search depth segmentation scheme; Step 4: According to the optimal partitioning scheme was to achieve the program between the mobile device and the server's code 迀 shift and distributed execution.
2. 根据权利要求1所述的一种基于带宽自适应代码迀移的移动设备节能方法,其特征在于,所述的概率阈值P。 2. According to one of claim 1, wherein the mobile device based on energy saving in bandwidth is shifted adaptive codes 迀, characterized in that the probability of the threshold value P. 设定为〇. 85。 Set to square. 85.
3. 根据权利要求1所述的一种基于带宽自适应代码迀移的移动设备节能方法,其特征在于,所述的经验常数a设定为0. 4。 3. According to one claim 1, wherein the mobile device based on the code 迀 adaptive bandwidth saving shift method, characterized in that the empirical constant a is set to 0.4.
Descrição  traduzidas do Chinês
-种基于带宽自适应代码迁移的移动设备节能方法 - Kind of code migration based on adaptive bandwidth saving method for a mobile device

技术领域 TECHNICAL FIELD

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

背景技术 Background technique

[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 problem for 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. 根据程序分割方案将应用程序的一部分代码迁移到服务器端运行,可W缩短应用程序的运行时间,降低移动设备的能量消耗。 According to the program segmentation scheme will migrate part of the application code to run on the server, it can shorten the running time W applications, reduce energy consumption of mobile devices.

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

[0004] 于是Sinha等研究者进一步提出了自动程序分割方案,该种方法无需借助额外工具,不依赖于程序员,可W透明地实现程序自动分割,适用于移动平台。 [0004] So Sinha and other researchers have proposed automatic procedure further segmentation scheme, the method without the aid of additional tools, not dependent on the programmer, you can implement the program automatically and transparently W segmentation 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 presented 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 results. 而Messer等人和Bialek等人则采用纯动态程序分析方法构造对象关系图,相比纯静态分析,纯动态程序分析能够获取更为精确的程序运行时信息,但得到的对象关系图庞大复杂,导致程序分割开销过大,不适用于资源有限的移动平台。 And Messer et al. And Bialek, who are pure dynamic program analysis method to construct the object graph, compared to pure 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 large, it does not apply to the limited resources of mobile platforms. Wang Lei等人通过构造两层对象关系图,提出了适用于不同目标模型的程序分割方案和基于化va的分布式系统框架,但并未对程序分割方法进行具体研究,没有考虑移动环境中带宽的变化。 Wang Lei, who object graph by constructing two proposed models for different target program partitioning scheme and distributed systems framework of va-based, but the program did not carry out specific research division method, without considering the bandwidth of the mobile environment changes.

[0005] 程序分割的关键是如何选择程序的最优分割方案,尽可能实现移动设备能耗最小和数据传输开销最小。 [0005] The key to the program is how to choose the optimal segmentation segmentation scheme program, as mobile energy and data transmission equipment minimum overhead to a minimum. 由于数据传输开销与网络带宽直接相关,不同的带宽会对应不同的最优分割方案。 Since the data transmission overhead directly related to network bandwidth, different bandwidth will correspond to different optimal partitioning scheme. W往的程序分割通常假设带宽固定不变,如Diaconescu等人即根据静态带宽计算网络传输开销W决策程序分割,并未考虑网络环境因素(如带宽)的变化。 W program to split the bandwidth is generally assumed constant, such as Diaconescu, who calculated that, according to the network transmission overhead static bandwidth W is divided decision-making procedures, 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 kind of segmentation scheme can not fully utilize the bandwidth resources in higher bandwidth conditions, resulting in a waste of resources network. Byung-Gon等人通过分析移动设备和网络环境的异构和动态变化特性,提出了动态程序分害d,但频繁的程序分割任务势必为移动设备带来较大的额外开销负担。 Byung-Gon, who through the analysis of heterogeneous and dynamic characteristics of mobile devices and network environment, presents a dynamic program points harm d, but frequent procedures segmentation task is bound to bring a large overhead burden for mobile devices.

发明内容 SUMMARY OF THE INVENTION

[0006] 针对移动设备能量资源有限问题,为了有效节省移动设备的能量消耗,并克服静态程序分割不适用于带宽变化的移动环境和动态程序分割额外开销较大的问题,本发明提出一种基于带宽自适应代码迁移的移动设备节能方法。 [0006] for mobile devices finite energy resources issues, 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 program 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 code migration, the specific process is as follows:

[0008] 步骤1,构造加权对象关系图,具体是;首先,对应用程序进行静态程序分析,根据应用程序的方法调用关系,获取应用程序中的对象和对象间的调用关系,构造应用程序初始的对象关系图(InitialObjectRelationGraph,I0RG),对象关系图的节点和边分别对应应用程序对象和对象间的调用关系;然后,通过动态程序分析获得对象关系图中各节点对象的运行时间W及对象间的调用关系(每条边)的通信数据量,得到加权对象关系图。 [0008] Step 1 to construct a weighted object graph, in particular; First, the application of static program analysis, calls the relationship according to the method of the application, the application gets called relations of objects and between objects, construct the initial application The object graph (InitialObjectRelationGraph, I0RG), object graph nodes and edges corresponding to each application object and calls the relationship between objects; and then, through a dynamic program analysis to obtain the relationship between objects in each node diagram objects, and object run-time W traffic data call relation (each side) to obtain a weighted object graph.

[0009] 步骤2,基于W上加权对象关系图,将带宽作为一个变量,建立基于运行时间和耗电量的程序分割优化模型。 [0009] In step 2, based on the W-weighted object graph, as a variable bandwidth, establish segmentation model based optimization program run time and power consumption. 令Xi标识节点i的运行位置,Xi= 1和Xi= 0分别表示节点i在移动设备和服务器端运行,则程序分割方案可表示为X= {X。 So i Xi identifies a node running position, Xi = 1 and Xi = 0 represent the node i run on mobile devices and server-side, the program segmentation scheme can be expressed as X = {X. X2,…,X。 X2, ..., X. },n为节点个数,令b 表示当前带宽。 }, N is the number of nodes, so that b indicates the current bandwidth. 程序分割优化模型的目标在于求得最优分割方案玄,满足^ = w'g熙, Xp为模型求解空间,W〇(,b)表示当前带宽为b时程序分割方案X的优化模型,具体定义如下: Program segmentation optimization model aims to find an optimum partitioning scheme mysterious, meet ^ = w'g Xi, Xp as a model for solving space W〇 (, b) indicates the current bandwidth is b segmentation optimization model program X program, the specific It is defined as follows:

[0010] W化b)=WtXT化b)化。 [0010] W of b) = WtXT of b) of. 加+"6XE化b)化。。31 Plus + "6XE of b) of ..31

[0011] 其中,打。 [0011] where, playing. . . 1和E 分别表示程序全部运行在移动设备时的运行时间和耗电量;Wt 和W。 1 and E represent all the procedures in the Run time and power consumption of mobile devices; Wt and W. 分别表示运行时间和耗电量的权重,且满足Wt+Wg= 1 ;T化b)和E化b)分别表示当前带宽为b时采用程序分割方案X的程序运行时间和耗电量;模型求解空间Xp表示为: Represent the right running time and power consumption of the heavy, satisfying Wt + Wg = 1; T of b) and E of the b) show the current bandwidth for the introduction of the program run time and power consumption when X program segmentation scheme b; model Solving space Xp expressed as:

[0012] 一Y,卡叫Y,6,) < 中早,夺(1+。)} [0012] a Y, card called Y, 6,) <in the morning, and took (1+.)}

[001引其中,带宽阔值bi为满足条件? [001 which lead with broad bi value to satisfy the condition? 化>bi) 。 Of> bi). 的最大带宽值,P。 The maximum bandwidth value, P. 为所设定的概率阔值;为带宽bi下最优分割方案对应的模型值;a> 0为经验常数,用W设定W0(,bi)的上限值为狀的',夺(1 +。)。 The probability of the set threshold value; for the lower-bandwidth bi optimal segmentation model values corresponding programs; cap a> 0 is a constant experience with W set W0 (, bi) values like ', wins (1 +.).

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

[0015] 所述的分支定界程序分割方法基于分支定界深度优先捜索法,深度捜索的约束条件包括;1)程序分割方案在当前带宽b下对应的优化模型值小于当前保存的优化模型的最小值;2)程序分割方案在带宽阔值bi下的模型目标值不高于所设定模型上限值中等',夺(1 +。)。 Branch and Bound program segmentation method [0015], wherein based on branch and bound depth first Dissatisfied Sofa, depth Dissatisfied cable constraints include; 1) Program segmentation scheme in the current bandwidth b under the corresponding optimization model is less than optimal model currently stored in minimum; 2) Program segmentation scheme in the model with a wide target value of not higher than bi set limits on the model moderate ', wins (1 +).

[0016] 所述的基于最小割的贪屯、方法,利用Stoer-Wagner最小割算法求得带宽为b和bi 时对应的运行在移动设备的节点集合Cb和运行在服务器端的节点集合&,,令待分割节点F' =FQ-&,,对V'中节点进行分割,采用Stoer-Wagner最小割算法中的最大邻接值排序算法对节点进行排序,然后基于贪屯、策略,同时根据与分支定界程序分割方法中相同的深度捜索的约束条件选取最优分割方案。 [0016] Based on the minimal cut of greed Tuen method using Stoer-Wagner minimum cut algorithm to obtain the bandwidth b and bi run when the corresponding node set Cb and mobile devices running on the server side set node & ,, Order to be split node F '= FQ- & ,, for V' in the node segmentation using Stoer-Wagner minimum cut algorithm maximum value adjacent nodes sorting algorithm to sort, and then based on greed village, strategy, and in accordance with the branch delimitation of the same program segmentation constraints depth Dissatisfied cord select optimal partitioning scheme.

[0017] 步骤4,根据步骤3求得的最优分割方案,实现程序在移动设备和服务器间的代码迁移和分布式执行,有效降低应用程序的执行时间和移动设备的耗电量,延长移动设备的电池使用寿命。 [0017] 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.

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

附图说明 Brief Description

[0019] 图1为本发明的带宽自适应程序分割流程图; Bandwidth adaptive procedure [0019] FIG. 1 is a schematic flow diagram division invention;

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

[0021] 图3为本发明的示例程序初始对象关系图; [0021] The sample program in Figure 3 of the present invention the initial object graph;

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

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

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

[00巧]图7为采用S种方法构造加权对象关系图的大小比较示意图; [00 Qiao] Figure 7 is a size S method using a weighted object relational structure schematic diagram of comparison;

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

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

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

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

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

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

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

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

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

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

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

[0037] 图19为本发明的MCGAP方法的分割结果在不同带宽下对应的加权模型值对比示意图; Compare weighted value segmentation model MCGAP method [0037] FIG. 19 of the present invention at different bandwidths corresponding to the schematic;

[003引图20为本发明的BBAP与MGCAP的平均性能对比图。 [003 cited Figure BBAP and MGCAP average performance comparison chart 20 of the present invention.

具体实施方式 DETAILED DESCRIPTION

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

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

[0041] 步骤1,构造加权对象关系图。 [0041] Step 1 to construct a weighted object graph.

[0042] 本发明实施例W-个化va程序为例来阐述加权对象关系图的构造过程,示例程序如图2所示,程序包含四个类;FacePreview、ImageCap1:ure、FaceDetection和FaceDetectionLib,其中FacePreview类的main方法中创建了一个ImageCap1:ure对象和两个化ceDetection对象,而两个化ceDetection对象均在执行自身Detect化ce方法时调用了化ceDetecticmLib类的ProcessBlock方法。 Example W- implement a program of va [0042] The present invention is an example to illustrate the weighted object graph construction process, the sample program, the program includes four classes shown in Figure 2; FacePreview, ImageCap1: ure, FaceDetection and FaceDetectionLib, which FacePreview class main method creates a ImageCap1: ure object and two of ceDetection object, call the ProcessBlock method of ceDetecticmLib class and two of ceDetection when objects are in the implementation of self-Detect ce methods. 首先,进行静态程序分析,利用指向分析(Points-to)技术分析化va程序的字节码文件,得到其方法调用关系图,并通过遍历调用关系图获取程序的所有对象及对象间的调用关系,从而构造出程序的初始对象关系图(I0RG),其节点和边分别对应应用程序的对象和对象间的调用关系。 First, static program analysis, the use of point analysis (Points-to) technical analysis of va program bytecode file, obtain its method call graph, and get calls all the objects and relations between objects by traversing program call graph , thereby constructing a program calling relationships initial object graph (I0RG), its nodes and edges corresponding to application objects and objects. 图3表示为示例程序对应的初始对象关系图,S_FacePreview创建对象D_ImageCap化re、D_ 化〇6〇61日。 Figure 3 shows a sample program for the corresponding initial object graph, S_FacePreview create objects D_ImageCap of re, D_ 6 billion of the 61 billion daily. 1:;[0]11 和D_FaceDetection2,对象D_FaceDetectionl和D_FaceDetection2 都调用S_FaceDetectionLib的方法,其中S_和D_前缀分别表示静态对象和动态对象。 1:; [0] 11 and D_FaceDetection2, objects D_FaceDetectionl and D_FaceDetection2 are calling S_FaceDetectionLib, wherein and D_ S_ prefix denote static and dynamic objects. 由于节点间的交互主要W方法调用的方式体现,其通信数据主要表现为方法调用的参数及返回值,在动态程序分析阶段,利用化va字节码重写技术,可W获得程序I0RG中每个节点对象的CPU运行时间W及每条边(对象间的调用关系)的通信数据量,即加权对象关系图中各节点与边的权值。 Mainly because of the way the interaction between nodes W method invocation expression, parameters and return values of the communication data mainly for method invocation, the dynamic program analysis phase, the use of va bytecode rewriting technology, W obtained in each program I0RG traffic data node object W CPU time and each edge (calling relationship between objects), that is the weight of each node and edge-weighted object relational graph. 图4表示为示例程序对应的加权对象关系图,例如节点S_FacePreview 所代表的对象的CPU运行时间为50ms,节点S_FacePreview与节点D_ImageCap化re之间的通信数据量为9066bytes。 Figure 4 shows a sample program for the weighting corresponding object graph, such as CPU time S_FacePreview node represents object is 50ms, traffic data nodes and node D_ImageCap of re S_FacePreview between the 9066bytes.

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

[0044] 考虑到移动环境中带宽的变化,本发明将带宽作为一个变量,提出基于运行时间和耗电量的程序分割优化模型,令Xi标识节点i的运行位置,X 1=1和X 1=0分别表示节点i在移动设备和服务器端运行,则程序分割方案可表示为X= {X。 [0044] Taking into account the changes in the mobile environment, the bandwidth, the present invention is a variable bandwidth as proposed segmentation optimization model based on running time and power consumption of the program, so that the operating position Xi identified node i, X 1 = 1 and X 1 i = 0 represent the node running in the mobile device and the server, the program segmentation scheme can be expressed as X = {X. X,,…,X。 X ,, ..., X. },b表示当前带宽,玄表示最优程序分割方案。 }, B represents the current bandwidth, mysterious segmentation program represents the best solution. 程序分割优化模型的目标在于求得最优分割方案支,满足^ =arg喊,X康示模型求解空间,W化b)表示当前带宽为b时分割方案X的优化模型,具体定义如下: Program segmentation optimization model aims to find an optimum segmentation program support to meet ^ = arg shout, X Sport model shown solution space, W of b) indicates the current bandwidth is b segmentation optimization model program X, specifically defined as follows:

[0045]W佑b) =WtXT狂,b) /lYocal+WeXE佑b)/Etocal [0045] W Woo b) = WtXT mad, b) / lYocal + WeXE woo b) / Etocal

[004引其中,Tl。 [004 cited where, Tl. . . 和EL。 And EL. . . 分别表示程序全部运行在移动设备时的运行时间和耗电量;Wt和w。 Represent all the procedures run uptime and power consumption when the mobile device; Wt and w. 分别表示运行时间和耗电量的权重,且满足Wt+W,= 1 ;T化b)和E化b)分别表示当前带宽为b时采用程序分割方案X的程序运行时间和耗电量;模型求解空间Xp表示为: Represent the right running time and power consumption of the heavy, satisfying Wt + W, = 1; T of b) and E of b), respectively, with the program running time and power consumption program into the program X of the current bandwidth is b; solving the model space Xp expressed as:

[0047] 不'卡ir片,占,)<狀的.夺(1 + ")} [0047] No 'cards ir sheet, accounting,) <like. Wins (1 + ")}

[004引其中,带宽阔值bi为满足概率? [004 cited in which to meet with a wide bi probability value? 化>bi) >P。 Of> bi)> P. 的最大带宽值,P。 The maximum bandwidth value, P. 为概率阔值,主要根据无线移动环境中的带宽变化情况具体设定,本发明的实施实验中设定P。 The probability threshold value, the main specific set according to the bandwidth of wireless mobile environment changes, the implementation of experiments of the present invention is set P. 为0.85。 0.85. 为带宽bi下最优分割方案而r对应的优化模型值;a为经验常数,用W设定Wa,bi) 的上限值为W(X;;;^6,)x(l+a),其中a的优选值与具体应用程序及其移动环境有关, 本发明设定的优选范围为0 <a< 1,本发明中根据对具体应用程序的实验测试,该参数的优选值为a= 0. 4。 For the next bi optimal partitioning scheme of bandwidth optimization model corresponding to the value r; upper limit to experience a constant, set by W Wa, bi) the value of W (X ;;; ^ 6,) x (l + a) in which a preferred value of specific applications and their mobile environment, preferably in the range of the present invention is set to 0 <a <1, the present invention is based on the application-specific laboratory tests, it is preferable that the parameter value a = 0.4.

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

[0050] [0050]

Figure CN102968173BD00081

[005。 [005. 其中,t"i占分别表示节点i在移动设备与服务器端的运行时间,节点i在移动设备的运行时间在动态分析阶段可W得到,即节点i的权重,设服务器计算速度是移动设备的k倍,则; Wherein, t "i accounting denote node i at run time the mobile device and the server, node i at run time the mobile device can W obtained in dynamic analysis stage, that node i weights located server computing speed is k mobile devices times, then;

[005引tnd=tnii/k [005 cited tnd = tnii / k

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

[0054] tij=Wij/b [0054] tij = Wij / b

[00巧]带宽为b时采用程序分割方案X的程序耗电量E〇(,b)表示为: [00 Qiao] bandwidth segmentation scheme with the program when b X program power E〇 (, b) is expressed as:

[0056] [0056]

Figure CN102968173BD00082

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

[0058] Ei=tniiXPcpu [005引Eu=tijXPw [0058] Ei = tniiXPcpu [005 cited Eu = tijXPw

[0060] 由于支6义户,则ff庐6,)含,&,)x(l+。)。 [0060] Since the branch 6 meaning households, then ff cottage 6) containing, &,) x (l +.). 若b>bi,则叫玄,6):^巧'府,)《巧、呵,6')><"+"); 又由于? If b> bi, then called mysterious, 6): ^ clever 'house,) "clever, oh, 6')> <" + "); and because? 化>bi) >P。 Of> bi)> P. ,因此在目标模型中最优分割方案克满足: And therefore the target model optimal partitioning scheme grams met:

[0061] 今胖&) <R'(A耳',占,)x(l+a))SPc [0061] this fat &) <R '(A ear', accounting,) x (l + a)) SPc

[0062] 该说明所求最优分割方案在带宽变化情况下能够W概率P。 [0062] The note asked for the optimal segmentation program changes in the bandwidth can W probability P. 使所对应优化模型的值满足求解空间Xp的阔值限制条件。 So that the value of the corresponding optimization model to solve the space Xp meet the threshold value restrictions.

[0063] 该模型中运行时间和耗电量的权重可W由用户根据移动设备剩余电量和对程序响应时间的需求灵活设定。 [0063] In this model run time and power consumption W weights can flexibly set by the user according to the needs of the remaining power of mobile devices and application response time. 特别地,当Wt= 1和Wg= 0时,即对应运行时间最优模型;当Wt =0和w,= 1时,即为耗电量最优模型。 In particular, when Wt = 1 and Wg = 0, that corresponds to the optimal model run time; when Wt = 0 and w, = 1, the power consumption is the best model.

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

[0065] 在上述加权对象关系图和程序分割优化模型的基础上,首先,基于深度优先捜索策略,提出分支定界程序分割方法炬BAP),深度捜索的约束条件不仅满足分割方案在当前带宽下对应的优化模型值小于当前保存的最小优化模型值,同时还需保证此分割在带宽阔值bi下的模型值不高于所设定的优化模型的上限值,从而避免所选分割方案在带宽较低时开销过大,实现对带宽变化的适应性。 [0065] In the weighting object graph and program segmentation optimization-based model, the first based on the depth priority Dissatisfied search strategy, proposed branch and bound program segmentation torch BAP), depth Dissatisfied cable constraints not only meet segmentation scheme in the current bandwidth corresponding optimization model is less than the minimum optimum model values currently stored, while the need to ensure that this split in value with broad bi model value is not higher than the upper limit set by the optimization model, thus avoiding the selected segmentation program low bandwidth overhead is too large to achieve bandwidth adaptability to change. 但由于在最坏情况下方法时间复杂度为0(2") (n为节点个数),该方法不适用于对象(节点数)较多规模较大的应用程序,在本发明的实验平台下当移动应用程序对应的对象节点数大于200时,该方法计算程序分割的求解时间会明显增加。为此,本发明针对大规模应用程序,从贪屯、策略考虑提出启发式的基于最小割的贪屯、方法(MCGAP)。MCGAP方法采用最小割Stoer-Wagner方法中用到的最大邻接值排序方法对对象节点进行排序,WBBAP方法中的约束条件为限制,基于贪屯、策略快速解得程序分割方案。 But because in the worst case time complexity of the method is 0 (2 ") (n is the number of nodes), the method is not suitable experimental platform of the present invention for objects (nodes) are more large-scale application, When the mobile application at the object corresponding to the number of nodes is greater than 200, the method of calculating program segmentation solution time will be significantly increased. For this reason, the present invention is directed to large-scale applications, from greedy Tuen, consider making heuristic strategy based on minimum cut greed Tuen method (MCGAP) .MCGAP method using the minimum cut Stoer-Wagner method used in the adjacent maximum value for the object node sort method to sort, WBBAP process constraints as limiting, fast solution was based on greed village, strategy program segmentation scheme.

[0066] 本发明从捜索策略和贪屯、策略考虑,提出分别适用于小规模和大规模应用程序分割的分支定界程序分割法炬BA巧和基于最小割的贪屯、方法(MCGAP),其伪代码分别如图5,图6所示,其中输入主要包括当前带宽b、带宽阔值bi,W及程序对应的加权对象关系图W0RG = (V,E,Wv,W。),V、E、Wv和W。 [0066] The present invention Dissatisfied with Cable policies and greed from Tuen, policy considerations were proposed for small-scale and large-scale applications split the branch and bound program segmentation Faju BA clever and based on a minimum cut of greed Tuen method (MCGAP), pseudo-code shown in Figure 5 thereof, respectively, as shown in FIG. 6, wherein the input includes current bandwidth b, broad band values bi, W, and an object program corresponding to the weighted graph W0RG = (V, E, Wv, W.), V, E, Wv and W. 分别表示节点集合、边集合、节点权重集合和边权重集合; 输出为程序的最优分割方案和优化模型对应的值。 Collection of nodes, respectively, while the collection, a collection of node weight and heavy weight set of edges; output for the program of optimal partitioning scheme and optimization model corresponding value.

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

[0068] 由于带宽越高,数据传输开销越低,因此,带宽较高情况下运行于移动设备的节点在带宽降低时将仍运行于移动设备,而带宽较低情况下运行于服务器的节点在带宽升高时将仍运行于服务器。 [0068] Due to the higher bandwidth and lower data transmission overhead, therefore, under circumstances node running high-bandwidth mobile devices at lower bandwidth will still run on mobile devices, while the bandwidth lower case node running on the server in the It will still be running on the server bandwidth increases. 记Xb= (Cb,Sb)表示带宽b下对应的程序最优分割方案,Cb和Sb分别表示带宽为b时运行在移动设备和服务器端的节点集合,对于某个带宽B下对应的程序最优分割方案Xb= (Cb,Sb),有;(1)公(2)公>/,或MCGAP 方法中,考虑在b与bi间变化的带宽,设;-=(旬。成。)为模型最优解,则有QCQ,。 Remember Xb = (Cb, Sb) b represents the bandwidth corresponding to the optimal partitioning scheme program, Cb and Sb denote the bandwidth is b nodes running the mobile device and the server set for the next program a corresponding optimal bandwidth B segmentation scheme Xb = (Cb, Sb), are; (1) male (2) public> /, or MCGAP method, considering changes in between b and bi bandwidth provided; - = (late into.) as model optimal solution, there QCQ ,. ,&,ES。 , &, ES. ,。 . .

[0069] 如图6所示,MCGAP方法首先在第1行代码中将所要求解的优化模型最优值minValue初始化为一个所能表示的最大整数。 As shown in [0069] FIG. 6, MCGAP method first line of code in the first model in the optimization solution of the desired optimum value minValue initialized to a maximum integer that can be represented. 第2-4行根据Stoer-Wagner方法分别求得静态带宽b和bi下的最优程序分割方案(Cb,Sb)和(C;,&),并根据(C;,&)对应的优化模型最优值设定带宽bi下优化模型值的上限值Wbi。 2-4 lines were obtained by the method according to Stoer-Wagner program segmentation scheme optimal static bandwidth b and bi under (Cb, Sb) and (C;, &), and according to (C;, &) corresponding optimization model setting an upper limit Wbi optimal value optimization model values of the bandwidth bi. MCGAP方法中第5-6行的AcUust函数根据Stoer-Wagner方法所求得的Cb和S&,调整程序的加权对象关系图,并确定待分割节点V',= ,即当带宽在61和^巧变化时只需决策^中节点的分割,^减小计算量。 MCGAP method AcUust function lines 5-6 Stoer-Wagner method according to the obtained Cb and S &, weighting adjustment program object graph and determine to be split node V ', =, that is, when the bandwidth at 61 and ^ clever Just when changes in the node split decision ^ ^ reduce the amount of calculation. 第7-18行即基于最小割求解程序的最优分割方案,其中第8行MA_0rder函数采用最小割Stoer-Wagner方法中的最大邻接值排序方法对节点进行排序;第9-11行基于贪屯、策略确定当前选择的分割方案(C,S),C和S分别表示当前分割中运行在本地移动设备和服务器的节点集合,并计算此方案在带宽b和bi下对应的优化模型值Wb(C,巧和Wbi(C,S); 第12-15行根据与BBAP中相同的两个约束条件;Wbi(C,^<Wbi和Wb(C,^<minValue,其中Wbi表示带宽bi下程序分割优化模型的上限值,更新当前最优分割方案(Cmh,SmJ;第16-17 行Contract函数是将Vm_i和Vm两个节点合并,并从节点集合V'中删除节点Vm,其中Ag= Contract(Ai,A2)具体表示删除两个节点Ai和A2,生成一个新节点A3,并对于图中其他任意节点V,建立新边e= (Ag,V),更新其权重;W(Ag,V) =W(A。V)+W(A2,V)。最后MCGAP方法的第19行返回程序的最终最优分割方案(Cmi。,SmJ和优化模型对应的最优值minValue。 7-18 row which is based on minimum cut solver optimal partitioning scheme, where the first 8 rows MA_0rder function takes a minimum cut Stoer-Wagner method maximum value adjacent nodes sorting method for sorting; the first 9-11 rows based on greed Tun , policy determines the currently selected 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 bandwidth b and bi optimization model under corresponding value Wb ( C, clever and Wbi (C, S); 12-15 rows according BBAP same two constraints; Wbi (C, ^ <Wbi and Wb (C, ^ <minValue, which represents the bandwidth bi Wbi program dividing the upper limit of the optimization model, updating current best partitioning scheme (Cmh, SmJ; 16-17 rows Contract function is to merge Vm_i and Vm two nodes, and from the node set V 'is deleted node Vm, where Ag = Contract (Ai, A2) specifically shows deleting two nodes Ai and A2, generating a new node A3, and for any other node in the figure V, the establishment of the new edge e = (Ag, V), the update of the weights; W (Ag, V) = W (A.V) + W (A2, V). The first line of the last 19 MCGAP method returns the program eventually optimal partitioning scheme (Cmi., SmJ and optimization model corresponding optimal value minValue.

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

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

[0072] 下面将结合附图说明本发明提出的基于带宽自适应程序分割的移动设备节能方法相比其他方法的改进效果。 [0072] 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,运行化un化10. 10操作系统的化inkPad X201i笔记本。 First, in order to analyze the weighted object graph construction method of the present invention, the performance, the implementation platform memory 3. 0GB, CPU frequency of 2. 53GHz, run of the un-oriented operating system of 10.10 inkPad X201i notebook. 利用化va字节码分析与优化框架Soot工具和字节码重写技术,针对化capo Benchmarks程序,将本发明的加权对象关系图构造方法(CSDPAC)与纯静态分析方法(PSPAC)、纯动态分析方法(PDPAC)进行对比。 Use of va bytecode analysis and optimization framework Soot tools and bytecode rewriting technology for technology capo Benchmarks program, the object of the present invention will be weighted graph constructor (CSDPAC) and pure static analysis methods (PSPAC), pure dynamic Analysis Method (PDPAC) were compared. 图7和图8都是执行8个示例程序(Programs) 来进行对比,分風I是:avrora,h2,luindex,lusearch,pmd,sunflow,tomcat和xalan。 Figures 7 and 8 are executed eight sample program (Programs) to compare, divide the wind I was: avrora, h2, luindex, lusearch, pmd, sunflow, tomcat and xalan.

[007引图7表示S种方法所获取对象关系图的大小比较。 [007 cited Figure 7 shows the S Ways size comparison of the acquired object graph. 从图7可W看出,与PDPAC相比,CSDPAC与PSPAC所构造的加权对象关系图规模较小。 W can be seen from Figure 7, compared with PDPAC, CSDPAC constructed with PSPAC weighted object graph smaller scale. 该是由于CSDPAC与PSPAC均利用程序的静态信息删除系统库对象,对初始程序对象关系图进行裁剪,而PDPAC记录了包括系统库对象及其关系等所有运行时信息,对象关系图规模较大。 This is due to the CSDPAC PSPAC utilize static information and delete system libraries target program, the initial program object diagram for cropping, while PDPAC record includes all runtime information, object relational graph of the larger system library objects and their relationships.

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

[0075] 为评价本发明的BBAP与MCGAP方法的性能,实施平台采用内存为3. 0GB,CPU频率为2. 53GHz,运行Windows7操作系统的化inkPadX201i笔记本。 [0075] 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, run Windows7 operating system of inkPadX201i 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. 仿真实验针对程序分割模型的S种特殊情况;(l)Wt=l,Wg= 0(运行时间最优);(2)Wt= 〇,Wg= 1(能量最优);0)Wt= 0. 5,We= 0. 5,分别实施如下步骤: The simulation model for program segmentation S special case; (l) Wt = l, Wg = 0 (running time optimal); (2) Wt = billion, Wg = 1 (optimal energy); 0) Wt = 0 . 5, We = 0. 5, respectively performing the following steps:

[0076] (1)用Stoer-Wagner方法和BBAP/MCGAP方法分别求解带宽100化/s下的最优分割Cut(W,S_W, 100)和Cut(W,BBAP, 100)(或Cut(W,MCGAP, 100));其中S_W是Stoer-Wagner 方法的简称,W表示优化模型; [0076] (1) Stoer-Wagner method and BBAP / MCGAP Methods to solve the optimal segmentation Cut (W, S_W, 100) and Cut (W, BBAP, 100) (or Cut (W-bandwidth of 100 / s under , MCGAP, 100)); where S_W is referred Stoer-Wagner method, W represents optimization model;

[0077] 似分另y计算W上两个分割Cut爪S_W, 100)与Cut爪BBAP,100) (或Cut爪MCGAP,100))在不同带宽b下对应的模型值W{Cut爪S_W,100),W、 W{Cut爪BBAP, 100),b}(或W{Cut爪MCGAP, 100),b}); [0077] Another y calculated like points on two separate W Cut claw S_W, 100) and Cut claw BBAP, 100) (or Cut claw MCGAP, 100)) at different bandwidths b corresponding model values W {Cut claw S_W, 100), W, W {Cut pawl BBAP, 100), b} (or W {Cut pawl MCGAP, 100), b});

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

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

[0080] 特殊地,为了更加直观,对于(l)Wt= 1,We= 〇(运行时间最优)和似Wt= 0, 巧。 [0080] special, in order to be more intuitive, for (l) Wt = 1, We = square (optimal running time) and the like Wt = 0, clever. =1(能量最优)两种情况,实验结果将模型值等价转化为程序运行时间和耗电量,图中符号表示分别用'T'(Time)和'E'巧nergy)代替相应的'r(Wei曲t),即W{Cut(W,S_ W, 100),b}、W{Cut(W,BBAP, 100),b}(或W{Cut(W,MCGAP, 100),b})、Wmin化)和WLocal在(1)讯1=1,"6=〇情况下分别对应表示为了似11订,5_胖,100),6}、1'似11订,884?,100),6} (或T{CuUT,MCGAP,100),b})、Tmin(b)和TLocal,在(2)Wt= 0,We= 1 情况下分别对应表示为E{Cut(E,S_W, 100),b}、E{Cut(E,BBAP, 100),b}(或E{Cut(E,MCGAP, 100),b})、 Emin(b)和ELocal。 = 1 (energy optimal) In both cases, the model results will be converted to the equivalent value of the program run time and power consumption, the figure symbols were used to 'T' (Time) and 'E' clever nergy) instead of the corresponding 'r (Wei Song t), i.e., W {Cut (W, S_ W, 100), b}, W {Cut (W, BBAP, 100), b} (or W {Cut (W, MCGAP, 100), b}), Wmin of) and WLocal in (1) News 1 = 1, under "6 = square situation like that in order to correspond to 11 set, 5_ fat, 100), 6}, 1 'set like 11, 884? , 100), 6} (or T {CuUT, MCGAP, 100), b}), Tmin (b) and TLocal, in (2) Wt = 0, We = 1 corresponding to the next case are denoted as E {Cut (E , S_W, 100), b}, E {Cut (E, BBAP, 100), b} (or E {Cut (E, MCGAP, 100), b}), Emin (b) and ELocal.

[0081] 图11表示BBAP方法对目标模型S种特殊情况下的求解时间。 [0081] FIG. 11 shows a method for the target model BBAP S special case solution time. 图中Model_T、 Model_E和Model_W分别对应(l)Wt= 1 和We= 0 ;(2)Wt= 0 和We= 1 ;(3)Wt= 0. 5 和We =0. 5S种情况。 FIG Model_T, Model_E and Model_W respectively (l) Wt = 1 and We = 0; (2) Wt = 0 and We = 1; (3) Wt = 0. 5 and We = 0 5S case. 可W看出,对于节点个数较少的图,BBAP能够在较短时间内求出最优解; 对于节点个数较多的图,其求解时间较长。 W can be seen that the number of nodes for less Figure, BBAP able to find optimal solutions in a relatively short period of time; for the larger number of nodes Figure, which solved a long time. 该说明BBAP适用于规模较小的图,而对于节点数较多的图,如对于lusearch程序,BBAP的计算开销明显增大。 The note BBAP for smaller scale maps, and the number of nodes for more maps, such as procedures for lusearch, BBAP significantly increased computational overhead.

[0082] 图12、图13和图14分别表示为BBAP与其他方法在带宽变化情况下对应的程序运行时间(Wt=1,We= 0)、耗电量(Wt= 0,We= 1)和最优模型值(Wt= 0. 5,We= 0. W 的性能对比图。图12~14中分别给出了在四个程序的运行对比,四个程序分别是:(A) RandomGraphl程序,炬)RandomGraph2 程序,(C)lusearch程序,(D)avrora程序。 [0082] FIG. 12, FIG. 13 and FIG. 14 are denoted BBAP with other methods in the case of bandwidth changes corresponding to the program running time (Wt = 1, We = 0), the power consumption (Wt = 0, We = 1) and the optimal model values (Wt = 0. 5, We = 0. W Performance Comparison Figure 12 to 14 are given the contrast in running four programs, four programs are:. (A) RandomGraphl program , torch) RandomGraph2 program, (C) lusearch program, (D) avrora program. 在图12 中,1'{〇11订,884口,100),6}和1'{〇11订,5_胖,100),6}分别表示带宽为100化/3时用邸八口和Stoer-Wagner方法得到的最优分割方案化t订,BBAP,100)和化t订,S_W,100)在不同带宽b下对应的程序运行时间。 In FIG. 12, 1 '{〇11 set, 884, 100), 6} and 1' {〇11 set, 5_ fat, 100), respectively, 6} of bandwidth is 100 / 3:00 with DI eight and Stoer-Wagner obtained the optimal partitioning scheme of t set, BBAP, 100) and a set of t, S_W, 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. 化ocal表示不采用程序分割,即程序全部在移动设备本地执行的时间。 Of ocal said they did not use the program split time that is all the procedures performed locally in the mobile device. 可^看出,1'{〇1*订,884?,100),6}与而111化)在多数情况下均小于化ocal,而T{Cut(T,S_W,100),b}在带宽较大情况下也小于化ocal,该说明利用程序分割实现代码迁移,能够有效降低应用程序的运行时间。 Can be seen ^, 1 '{〇1 * set, 884? 100), while 111 of the 6}), in most cases less than of ocal, while T {Cut (T, S_W, 100), b} in bandwidth is less than the larger situation of ocal, the note use segmentation to achieve code migration program can effectively reduce the run time of the application. 当带宽大幅度下降时,静态程序最优分割化t订,S_W,100)对应的运行时间T{Cut订,S_W,100),b}急剧增长,随带宽变化波动较大。 When a significant decline in the bandwidth, static program provides optimal partitioning of t, S_W, 100) corresponding to the running time T {Cut set, S_W, 100), b} rapid growth, with the bandwidth variation volatile. 而1'{化*订,884?,100),6}较接近于不同带宽下的程序最短运行时间而111化),且波动较为平缓。 And 1 '{* set of 884? 100), 6} program closer to the minimum running time and under different bandwidths of 111), and the volatility is more gentle. 图13和图14对应的程序耗电量和最优模型值具有类似结论。 Figures 13 and 14 corresponding procedures consumption values and the optimal model with similar conclusions. 该说明相比静态Stoer-Wagner方法,BBAP能够较好地适应带宽变化,减少应用程序运行时间和耗电量; 而与每个不同带宽下均需重新计算分割的动态方法相比,BBAP仅需分割一次,降低了分割开销。 The note 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 time division, the division reduces overhead.

[008引图15为MCGAP方法对目标模型S种特殊情况下的求解时间。 [008 cited 15 is MCGAP approach the target model S special case solution time. Model_T、Model_E和Model_W分别对应(l)Wt= 1和We= 0(运行时间最优);(2)wt= 0和We= 1 (能量最优); 做Wt=0. 5和讯。 Model_T, Model_E and Model_W respectively (l) Wt = 1 and We = 0 (running time optimal); (2) wt = 0 and We = 1 (optimal energy); do Wt = 0 5 and news. =0. 5。 = 0.5. 与图11比较,可W看出,图节点个数较少时MCGAP方法的求解时间与BBAP方法相差不大;而节点个数较多时MCGAP方法的求解时间明显减少。 Compared with FIG. 11, it can be seen in W, when the number of nodes in FIG less MCGAP method for solving time and BBAP method less; while the number of nodes more MCGAP method for solving time is significantly reduced.

[0084] 图16为MCGAP方法与BBAP方法在不同带宽下求解的程序最短运行时间对比图。 [0084] 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(义/,)/W访,/,)为MCGAP方法近似解的精确度。 Let X model BBAP solve for the optimal solution, approximate optimal solution X is obtained using MCGAP method, the W (meaning /,) / W access, /,) with an accuracy of MCGAP approximate solution method. 从图16可W看出,MCGAP求解的最短程序运行时间较接近于BBAP对应的最优解,精确度较高,可用于较快地求得规模较大对象关系图的近似最优解。 W can be seen from Figure 16, the shortest program run time MCGAP solving BBAP closer to the optimal solution corresponding to the higher accuracy, it can be used to approximate the optimal solution quickly obtained large-scale object-relational graph.

[0085] 图17、图18和图19分别为MCGAP与其他方法在带宽变化情况下对应的程序运行时间(Wt=l,We= 0)、耗电量(Wt= 〇,We= 1)和最优模型值(Wt= 0. 5,We= 0.W的性能对比图。图17~19中分别给出了在四个程序的运行对比,四个程序分别是:(a)avrora程序,(b)lusearch程序,(c)luindex程序,(d)h2程序。由图17,图18和图19可W看出,与程序全部运行在移动设备相比,利用程序分割和代码迁移可W降低移动设备的耗电量,缩短应用程序的运行时间;而与静态程序分割Stoer-Wagner方法相比,MCGAP对应的模型目标值较接近于不同带宽下的最小值,随带宽波动较为平缓。可见,随着环境中带宽的变化, MCGAP能够避免模型目标值因带宽降低而急剧增加,有效缩短程序运行时间,降低移动设备的耗电量。虽然图中动态方法的性能较好,但BBAP和MCGAP均避免了动态方法在不同带宽下多次计算分割的较大开销。如果考虑动态方法多次分割的计算开销,其性能将明显下降。 [0085] FIGS. 17, 18 and 19 respectively MCGAP and other methods in the case of bandwidth changes corresponding to the program running time (Wt = l, We = 0), the power consumption (Wt = square, We = 1) and . optimal model values (Wt = 0. 5, We = 0.W Performance Comparison Figure 17 to 19 are given the contrast in running four programs, four programs are: (a) avrora program, (b) lusearch procedures, (c) luindex program, (d) h2 program by 17, 18 and 19 W can be seen, all compared with the program run on mobile devices, the use of program segmentation and code migration to W reduce power consumption of mobile devices to shorten the running time of the application; compared with static program segmentation Stoer-Wagner method, MCGAP corresponding model closer to the minimum target under different bandwidths, the bandwidth fluctuations with more gentle visible. , as the environment changes in bandwidth, MCGAP target model can be avoided due to reduced bandwidth and increased dramatically shorten the program running time, reduce power consumption of mobile devices. Although the preferred method of dynamic performance figures, but BBAP and MCGAP both to avoid the overhead of a larger dynamic approach at different times to calculate the bandwidth divided. If we consider the computational overhead of dynamic segmentation method many times, the performance will be significantly decreased.

[0086] 图20为BBAP与MCGAP方法的平均性能对比图。 [0086] FIG. 20 is the average performance BBAP and MCGAP method comparison chart. TR1和ER1分别表示与采用S10er-Wagner方法相比,采用BBAP/MCGAP方法时程序平均运行时间和耗电量降低的百分比;TR2和ER2分别表示与程序全部运行在移动设备相比,采用BBAP或MCGAP方法时程序平均运行时间和耗电量降低的百分比。 TR1 and ER1, respectively, compared with a S10er-Wagner method using the average running time of the program to reduce power consumption and percentage of BBAP / MCGAP method; TR2 and ER2 respectively, all compared to run the program in a mobile device, or use BBAP The average operating time and lower power consumption percentage MCGAP method procedures. 可W看出,与程序全部运行在移动设备相比, 采用BBAP方法对应的程序平均运行时间和耗电量分别降低了44. 17%和34. 47%,采用MCGAP方法的程序平均运行时间和耗电量分别降低了37. 44%和46. 09% ;而与静态程序分割Stoer-Wagner方法相比,BBAP对应的平均运行时间和耗电量分别降低了26. 38%和25. 88%,MCGAP对应的程序平均运行时间和耗电量分别降低了26. 99%和30. 58%。 W can be seen that, compared with the program running all mobile devices using a method corresponding program BBAP average running time and power consumption decreased by 44.17% and 34.47%, MCGAP method using the average running time of a program and Power consumption was reduced 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 corresponding program average running time and power consumption decreased by 26.99% and 30.58%.

[0087] 通过W上具体实施实验验证,可W得出,在带宽不断变化的情况下,本发明的基于带宽自适应程序分割和代码迁移的移动设备节能方法,可W有效降低应用程序的执行时间和移动设备的耗电量,从而延长移动设备的电池使用寿命。 [0087] The specific implementation of experiments on W, W can be drawn, in the case of changing the bandwidth, the bandwidth of the present invention is based on an adaptive segmentation procedures and code migration of mobile equipment, energy saving methods, can effectively reduce the execution W application time and power consumption of mobile devices, thereby 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
*US2010/0131721 Título indisponível
*US2012/0060142 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
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