  We present a tight parametrical Hermite-Hadamard type inequality with
probability measure, which yields a considerably closer upper bound for the
mean value of convex function than the classical one. Our inequality becomes
equality not only with affine functions, but also with a family of V-shaped
curves determined by the parameter. The residual (error) of this inequality is
strictly smaller than in the classical Hermite-Hadamard inequality under any
probability measure and with all non-affine convex functions. In the framework
of Karamata's theorem on the inequalities with convex functions, we propose a
method of measuring a global performance of inequalities in terms of average
residuals over functions of the type $x\mapsto |x-u|$. Using average residuals
enables comparing two or more inequalities as themselves, with same or
different measures and without referring to a particular function. Our method
is applicable to all Karamata's type inequalities, with integrals or sums. A
numerical experiment with three different measures indicates that the average
residual in our inequality is about 4 times smaller than in classical right
Hermite-Hadamard, and also is smaller than in Jensen's inequality, with all
three measures.
