Neither of those aligners, by default at least, put unaligned reads in the SAM/BAM alignments. As a result 'flagstat' will always report 100% alignment.
For STAR I use the '--outSAMunmapped Within' option which puts the unmapped reads into the SAM output which makes it so flagstat will report some unaligned reads.
For tophat you can merge the 'unmapped.bam' alignments into the 'accepted_hits.bam' file and get accurate percentages from flagstat with the following list of commands:
samtools view -bF 0x100 accepted_hits.bam > primary_hits.bam
samtools merge merged.bam primary_hits.bam unmapped.bam
samtools sort -n merged.bam merged.nsort
samtools fixmate merged.nsort.bam final.nsort.bam
samtools flagstat final.nsort.bam