'Time Complexity Analysis of a function

What is the time complexity of this following function? I am confused between O(log n) and O(sqrt(n)).

map<long long int,long long int> mp;
void PrimeFactorization(long long n)
{
    while(n%2==0)
    {
        n/=2;
        mp[2]++;
    }
    for(long long int i=3;i<=sqrt(n)+1;i+=2)
    {
        while(n%i==0)
        {
            n/=i;
            mp[i]++;
        }
    }
    if(n>2)
    {
        mp[n]++;
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source