TITLE: Counting fundamental units of real quadratic fields
QUESTION [6 upvotes]: For a given real quadratic field $K$, the group of units of its ring of integers is $\mathcal{O}_K^{\times}\cong(\pm1)\times \mathbb{Z}$ by the Dirichlet unit theorem. For each $\mathcal{O}_K$, pick the fundamental unit as $\epsilon >1$, then $\epsilon=m\sqrt{d}+n$, where $m,n>0$ are integers or half integers. Now for a large variable $x>>1$, define the counting function $$
  u(x):=\sum_{1<\epsilon<x} 1,
$$
where the sum is over all real quadratic fields. 
Firstly the sum is finite, since by the above token, there are only finitely many $\epsilon=m\sqrt{d}+n$ with bounded absolute value as $d\rightarrow\infty$.
What asymptotic information is known about $u(x)$?

REPLY [8 votes]: In Proposition 4.1 of Sarnak you'll find an asymptotic for the related quantity (take there $p=1$) when one considers all ring discriminants (not just the fundamental field discriminants that you want).  If restricted to field discriminants, the work of Raulf obtains such asymptotic formulae (see Lemma 5.1 in that paper).  In both papers, the interest is in obtaining averages for the class number $h(d)$ when the discriminants are arranged according to the size of $\epsilon_d$.