user id of the profile in socialengine
$subject=Engine_Api::_()->core()->getSubject();
The above code returns the currently set subject. In profile the subject is the currently viewing profile.
So for get id of this profile, use the following code
$profileId=$subject->getIdentity();