Joint Computing and Electric Systems Optimization for Green Datacenters