The structure of trace formulas and their comparison