add total length in encoder output and complete most of the statistis calculation
Merge pull request #1530 from sijchen/after_review

[Encoder] add total length in encoder output and complete statistics