how to get count of total record
Until the issue Convert pager.inc to a service is solved you find the pager information still in global variables:

global $pager_page_array, $pager_total, $pager_total_items, $pager_limits;

$count_of_total_records = $pager_total_items[$element];


Where $element defaults to '0' if this is the first pager with no element id set.