Table comps are supposed to be based on the amount of your average bet times the amount of hands played. Then they take that total and the expected return from the game and come up with the theortical loss. You'll recieve a percentage of your theoritical loss back in comps.
Thats how its supposed to work.
In reality,the pitboss observes your first couple of bets,and writes down the average of them. Every so often he'll check to see if you are still betting the same. They credit you for an average amount of hands,each table getting the same amount.They also don't deduct for quick bathroom and smoke breaks,in most casinos. A few ,that have advanced technology,do.
To learn a great deal about how comps work,I highly recommend Comp City by Max Rubin.