Oh, and of course you need to remember that the aim is not to go to the nearest airfield ASAP, but to get there safely.
If the rough running disappears at, say, 50% power, and 50% power is enough to sustain flight, you'd better fly to the airport at 50% power with a smooth running engine, than at 100% power with a rough running engine.
This is a scenario that could be caused by a partial fuel line blockage, for instance due to a dirty filter. At 50% throttle the engine receives enough fuel so runs fine, but at 100% throttle fuel flow is too restricted, leading to a too-lean mixture. Not good.