"What in the name of Merlin are you doing?" said Ron, watching her as though fearful for her sanity.
Harry Potter and the Order of the Phoenix
What does the sentence truly mean? Is "in the name of Merlin" an idiom? I get the meaning of "in the name of": as someone else’s official representative, but I am not sure about the meaning of the whole phrase.