This sort of thing is commonly done for commercial printing, both for overall cost calculation and for setting up ink feeds on the press. (there are typically multiple ink feeds across the width of the press, so you can feed more ink to areas that need a lot, and less to those that don't.
However, the printing applications work from the actual separation tint/dot values used by the printing plates - so they'll know the actual CMYK or spot colour values, which simplifies things a lot.
If you're trying to calculate CMYK usage for an RGB image (and I assume you're looking at inkjet prints here, rather than commercial printing), then what you need to know is how the particular printer you're calculating for does its RGB to CMYK conversion. There is no single, fixed, conversion.
For example, one of the options you have when converting to CMYK is how much undercolour removal (UCR) or gray component replacement (GCR) to do - for colours with a grey component, you can either make the gray by mixing CMY, or by just using black - or some combination of the two.
If your printer uses ICC profiles to convert from RGB to CMYK, and you have access to those profiles, then using something like littleCMS (a free colour management library) may let you get closer to accurate values.
And you also need to allow for the printer settings - different media or quality settings are likely to use different amounts of ink (which might be handled by using different ICC profiles for the different settings).