Step 1: Pick a flat surface on your sample and apply a mask (sometimes called a resist layer) to this surface. This masked surface will serve as a datum plane.
Step 2: Place the sample on the table of a CMM (Coordinate Measurement Machine) with the masked side down on the table, and capture the 3D profile of the sample.
Step 3: Immerse the sample for a fixed time in a solution that dissolves the metal. Remove the sample from the solution, rinse, and dry it.
Step 4: Go to Step 2.
The etching solution should preferentially dissolve the stressed areas faster than the non-stressed areas. Of course, the use of an etching solution is a form of destructive testing, and it may cause the residual stress profile to change as the etching progresses. A nondestructive form of testing might be some sort of computed tomography (CT), but I am not sure of what type of CT beam. e.g., ultrasonic sound, x-rays, etc., would be sensitive to residual stress.