Stalling is a tough ruling to make. You need to put it into context. There is no good "clear" definition that I can think of. The existing definition needs to be somewhat vague so that judges can make a Stalling ruling based on the situation. When you see Stalling, you know it.
The damage swap example in the intial post is a classic endless loop problem. In LOTR, endless loops are resolved 2 ways:
1. The card(s) involvled in the endless loop are banned for standard-format play (the format used at all the major tournaments).
or
2. Endless-loop actions are limited to some minimum value.
In Pokemon, if time was short and I saw someone doing continue damage swapping or energy transferring just because they can, I'd rule Stalling. Like PokePop said, your actions need to be "useful."
Last week at a tournament, I had a player do PsyShadow a couple times, even though he had no more energy in his deck. He admittedly did it to stall out the clock, thinking he could do it just for the "heck of it." I didn't learn about this until after the match, and I gave him a Stalling warning.
Any decent judge should be able to catch Stalling. You have the "right" to play trainers and do other things that might not provide any apparent advantage, but useless actions, like endless damage swapping, endless energy transferring, or multiple deck searching certainly fit the definition of Stalling when time is short.
Personally, I wouldn't go as far as M45 and give the offending player's opponent an additional turn when time is called. I'd just issue the Stalling warning. Giving someone a last-turn advantage seems like a decent idea, but I personally do something different. I don't let the players see the official time clock. I don't call out time when there's 10 minutes or less left. If I see anyone continually looking at their watch or the room-clock, that's usually a good indication that they might be stalling.