I dont think what you found includes the cold-start time. I'd think it's more accurate to calculate the difference between execution start
and execution finish
in an empty https-triggered cloud function. This way the difference would strictly be the cold start time.
I'm not aware of a way to calculate this systematically. This is because the cold-start has nothing to do with the function itself. It's just an initialisation operation in the server where the function is hosted. Meaning that for all intents and purposes, the function doesn't even exist before initialisation and thus can not have access to the timestamp at the start of the cold-start.
I guess you'll have to do this manually to somehow get an average.
Edit0:
Perhaps you can create a script that stores the current time right before calling the https function. And then stores another timestamp right after the function returns with a status of 200. Then you just calculate the difference between the 2 timestamps. You get a relatively pure cold-start time.
Edit1:
If your question only refers to cloud functions, you should consider bypassing cold start altogether (which is what we've been doing). We did it by scheduling a Cron job on Cloud Scheduler. Here's the https function that keeps our login token generator "warm". It simulates a user requesting a login token every 30 seconds but it deletes the token immediately. You could do something similar.
It's very important to return status 200 in Cloud Scheduler (no matter what happens). We don't want the function to return any error code because this will terminate the Cron job.
exports.PreventColdStart = functions.https.onRequest((req,res) => {
admin.firestore().collection(...).doc(...).set({...}).then(()=>{
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
// Usage!
sleep(500).then(() => {
admin.firestore().collection(...).doc(...).delete().then(() => {
res.status(200).send('Successfully deleted');
}).catch((error) => {
res.status(200).send('Did not delete');
});
});
}).catch(()=>{
res.status(200).send('Could not find document');
})
})