gather state and output to stdout.