They sat by the hour eating anything they could spear on a toasting fork -- bread, English muffins, marshmallows -- and plotting ways of getting Malfoy expelled, which were fun to talk about even if they wouldn't work.
I'm not sure what exact "sat by the hour" means in this sentence. As I know, "by the hour" means per hour or once a hour. But I have a hard time to understand "sat by the hour" in this context. Is it the time they sat there is counted by the hour or they would sit there for a while every hour?
-- excerpted from Harry Potter.