cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. It is written entirely in Perl with no dependencies outside the standard distribution of Perl v5.6 and higher (code from some external modules is embedded within cloc) and so is quite portable. cloc is known to run on many flavors of Linux, Mac OS X, AIX, Solaris, IRIX, z/OS, and Windows. (To run the Perl source version of cloc on Windows one needs ActiveState Perl 5.6.1 or higher, or Cygwin installed. Alternatively one can use the Windows binary of cloc generated with perl2exe to run on Windows computers that have neither Perl nor Cygwin.)
The Google Singleton Detector, or GSD, is a tool which analyzes Java bytecode and detects the use of Singletons.
It's not quite as simple as that, however. First, GSD doesn't only detect singletons; it detects four different types of global state, including singletons, hingletons, mingletons and fingletons (see the usage section for descriptions). Second, it outputs a graph with all these different types of static state highlighted, and shows all the classes that are directly dependent on them. The point of this tool is to allow you to see all of the uses of global state inside a project, as well as how they are all interrelated. Hopefully you'll be able to locate global state that is heavily depended on and remove it.