The aim of this paper is to propose a computation offloading strategy, to be used in mobile cloud computing, in order to minimize the energy expenditure at the mobile handset necessary to run an application under a latency constraint. We exploit the concept of call graph, which models a generic computer program as a set of procedures related to each other through a weighted directed graph. Our goal is to derive the partition of the call graph establishing which procedures are to be executed locally or remotely. The main novelty of our workis th at the optimal partition is obtained jointly with the selection of the transmit power and constellation size, in order to minimize the energy consumption at the mobile handset, under a latency constraint taking into account transmit time, packet drops, and execution time. We consider both a single channel and a multi-channel transmission strategy, thus proving that a globally optimal solution can be achieved in both cases with affordable complexity. The theoretical findings are corroborated by numerical results and are aimed to show under what conditions, in terms of call graph topology, communication strategy, and computation parameters, the proposed offloading strategy can provide a significant performance gain.