I think what's being asked here is what to do once the attack has been stopped. Rendering assistance/calling PD & paramedics is mandatory, but I'd also suggest that you need to find anyone that saw what happened, get names and numbers, before they disappear. Or see if they can stick around and give statements. Secure any evidence, i.e., the knife he pulled on you, before some kid/vagrant finds it and takes it with them. If there was anyone in a vehicle nearby, write down what you remember about the description/occupants/license, etc. If you make any statements to the police on their arrival, keep it brief, and make sure you are not looking like the bad guy! Standing over the perp with a gun in your hand is not good form. If you have to say anything, keep it succinct, as in, "He came at me with a knife and said he was gonna cut my head off, and I had to shoot him to keep him from killing me." Leave it at that. You will likely spend the night in the lockup until things get sorted out, use the phone to call your significant other/friend/whoever to retain an attorney for you, and don't say anything else to detectives until he arrives. And unless you can post a large bond easily, you're probably gonna be in custody for 20 hours or more. TALK TO NO ONE! The prosecutor would love to put the drunk from your cell on the stand, telling how you gloated over killing that worthless scumbag. You knew if you ever had to use the gun, bad things would happen. Now they are......keep your wits about you! Have whoever you called phone your work, your relatives, those that need to know. Tell them not to lie about what happened, it's gonna be in tomorrow's paper anyway! Hopefully your boss is understanding, and will cut you some slack until you are arraigned, or released pending Warrant Application. With smart cops who realize who's the bad guy, you'll be home in a day or so, and once you are alone with your loved ones, then you can celebrate the fact that you survived the Dark Place.
And while society may villify you as a murderer, you alone will know that all you did was what you had to do to survive. Enjoy your victory, but do it behind closed doors!
Papajohn