Look into the HutongGames.PlayMakerEditor.FsmSearch class. It's not documented so you'll have to poke around a bit.
The FsmSearch class analyses FSMs and caches info in a format that can be more easily searched.
For a quick answer to your question, use this:
public static int GetVariableUseCount(Fsm fsm, NamedVariable variable)
Returns the number of times the variable is used in the fsm.
If you want to explore further:
public static FsmSearch Get(Fsm fsm)
Gets cached search info associated with an Fsm.
public static void Update(Fsm fsm)
Update the search info associated with an Fsm.
Actually there's too much to document here! I'll try to find some time to document it on the wiki...
NOTES:
- This editor API has not been tested outside of its use in the PlayMaker Editor. Exercising it outside of that context may expose dependencies/bugs
- There is a bug where variable usage inside a Run FSM action is not currently counted.