Statistical Mechanics and Stochastic Thermodynamics