In situ characterization technique for nanotribological investigations