I would like to complement Marc van Leeuwen's answer. I am going to use some results from the PDF that Marc linked (Axler's paper). First, we know that $V$ can be written as the direct sum of the generalized eigenspaces, $G(\lambda_i)$, $V = G(\lambda_1) \oplus \cdots \oplus G(\lambda_r)$, because generalized eigenvectors corresponding to different eigenvalues are linearly independent, and because the generalized eigenvectors span $V$. What is the shape of the matrix associated with $T$ under this basis? The direct sum translates into a block diagonal matrix
$$
T = \left[
\begin{array}{cccc}
M_1 & 0 & 0 & 0 \\
0 & M_2 & 0 & 0 \\
0 & 0 & \ddots & 0 \\
0 & 0 & 0 & M_r \\
\end{array}
\right],
$$
where $M_i$ is the operator $T$ restricted to $G(\lambda_i)$.
What is the shape of each $M_i$? Because we are working on $G(\lambda_i)=\{v\in V:(T-\lambda_i I)^kv=0 \text{ for some }k \in \mathbb{Z}^+\}$, we'll choose a basis constructed in the following way. If $(T-\lambda_i I)^kv=0$ for $k=1$, then $Tv=\lambda_iv$ and this translates into a diagonal element $\lambda_i$ in the matrix $M_i$ if we choose $v$ as an element of our basis. Now extract as many linearly independent vectors $v$ as you can that satisfy $(T-\lambda_i I)v=0$. Call them $B_i(k=1) = \{x_1,\ldots,x_p\}$. The $i$ makes reference to the $i$-th block $M_i$ and the $k$ indicates that we are working on a subspace of $G(\lambda_i)$ associated with the equation $(T-\lambda_i I)^kv=0$. So far, the matrix $M_i$ has the following structure with respect to $B_i(k=1)$.
$$
M_i = \left[
\begin{array}{cccc}
\lambda_i & 0 & 0 & ? & ? \\
0 & \ddots & 0 & ? & ? \\
0 & 0 & \lambda_i & ? & ? \\
0 & 0 & 0 & ? & ? \\
0 & 0 & 0 & ? & ? \\
\end{array}
\right],
$$
Now repeat the same process for $(T-\lambda_i I)^kv=0$ for $k=2$. Note that $(T-\lambda_i I)^2v=0$ implies that the vector $w=(T-\lambda_i I)v$ satisfies $(T-\lambda_i I)w=0$. Hence, $w$ can be written as a linear combination of the $x_1,\ldots,x_p$, which implies that there are scalars $c_1,\ldots,c_p$, such that
$$
c_1x_1 + \cdots c_px_p = w = Tv - \lambda_i v,
$$
and consequently that
$$
Tv = \lambda_i v + c_1x_1 + \cdots c_px_p.
$$
This means that $T$ acting on $v$ produces a multiple of $v$ plus a combination of vectors in $B_i(k=1)$. Thus, the matrix $M_i$ now looks like
$$
M_i = \left[
\begin{array}{cccc}
\lambda_i & 0 & 0 & \times & ? \\
0 & \ddots & 0 & \times & ? \\
0 & 0 & \lambda_i & \times & ? \\
0 & 0 & 0 & \lambda_i & ? \\
0 & 0 & 0 & 0 & ? \\
\end{array}
\right],
$$
with respect to the basis $\{x_1,\ldots,x_p,v\}$. The symbol $\times$ indicates a potentially nonzero entry. Continue building and appending the bases $B_i(k)$, $k=2,3,\ldots$, until you span the whole $G(\lambda_i)$. Finally, note that the resulting matrix $M_i$ is upper-triangular with the eigenvalues in the main diagonal. Hence, the multiplicity of $\lambda_i$, $m(\lambda_i)$, corresponds to the number of diagonal entries in $M_i$, i.e., the size of the block, and by construction, this same number tells us the dimension of $G(\lambda_i)$.