Here, we study the large-time limit of viscosity solutions of the Cauchy problem for second-order Hamilton-Jacobi-Bellman equations with convex Hamiltonians in the torus. This large-time limit solves the corresponding stationary problem, sometimes called the ergodic problem. This problem, however, has multiple viscosity solutions and, thus, a key question is which of these solutions is selected by the limit. Here, we provide a representation for the viscosity solution to the Cauchy problem in terms of generalized holonomic measures. Then, we use this representation to characterize the large-time limit in terms of the initial data and generalized Mather measures. In addition, we establish various results on generalized Mather measures and duality theorems that are of independent interest. Problem 1. Let T n = R n /Z n be the flat n-dimensional torus. Consider a nondegenerate diffusion coefficient, a : T n → [0, ∞). Fix a Hamiltonian H : T n × R n → R, and continuous initial data, u 0 : T n → R. Find a (viscosity) solution, u : T n ×[0, ∞) →