The gravitational collapse time of any object is simply
the inverse of the square root of G*rho where rho is the mean density.
Now real stars don't gravitationally collapse but are supported by various sources of pressure (thermal, degenerate, etc) and they are subject to sudden changes
For instance, a neutron star does not smoothly forms, it forms in about 1 second during Supernova phase. A white dwarf does form slowly from the contracting stellar core of the planetary nebulae but that rate is primarily determined by mass loss from the star which is highly variable.
So there is no "smooth" gravitational core collapse function for stars.
Thank you very much for your answer. I understand that there is no general trend for the gravitational core collapse. You mention that a neutron star forms in about 1 sec (steplike evolution). What about any gravitational collapse in the period between end of main sequence and red supergiant formation of this category of massive stars ?
Similarly, for solar-like stars, there should be a period of gravitational collapse of about 200*10^6 years between exit of main sequence and start of red giant. And also between asymptotic red giant phase and planetary nebula formation (1*10^6 years). Is there any trend for the rate of collapse during both these periods ? Concerning the high variability for the contraction phase of stellar core in planetary nebula, does it mean that the trend could be about anything (acceleration, deceleration, constant, wave, ...) depending on the actual life of the star up to then ?