Is it possible to figure out before transaction is completed, how much CPU an action in a smart contract will use? E.G. I make transaction with X actions + call to my smart - contract. Is possible to know how much CPU prev. actions took?
You can only do a very rough estimation based on previous action-calls by using the Hyperion-History get_actions-endpoint. The data returned has
"cpu_usage_us": ... "net_usage_words": ... "account_ram_deltas": ...
By using the data returned you could do estimates based on average values etc.but many other factors will play a role and cpu-usage is not 100% predictable.