added two functions one to stack time segments and another to calculate standard deviations. Cherry-picked from commit c55780de6e56c3cef799e02bc03d4ccfe04b7cb5 on graphite master.