Augmenting AVL tree to calculate sum of subtree
Your solution is traversing the whole subtree on each call to subSubtree so it is actually $O(|T|) \neq O(\log n)$ where $|T|$ is the length of the subtree. If I query the root of the tree it will go over every node, so complexity is $O(n)$.
If you keep the sum of the subtree while modifying it (insertions/deletions) then the pseudo-code will look like:
calculateSum(key):
    node = Search(key) // assuming I have a search function in O(log n)
    return node-&gt;size

Search can be implemented in $O(\log n)$ and getting the size is $O(1)$ since it is stored on the node itself, hence the overall complexity will be $O(\log n)$.