The writer of “Training Day” and “Harsh Times” brings us more cop movie grit with “End of Watch,” a vivid series of impressionistic sketches of a year in the lives of two Los Angeles police officers.

These aren’t the corrupt cops writer-director David Ayer built his name on. They’re just patrolmen, in a family of officers — sometimes heroic, often cocky, occasionally miscalculating. And in telling their stories episodically, with a rhythm that builds suspense slowly, Ayer gets at the level of trust they have to have for one another and the meaning of that old cop movie cliche — “He took a bullet for me.”

Brian Taylor (Jake Gyllenhaal) and Mike Zavala (Michael Pena) may be young, but they’ve been partners so long they’re like an old married couple — comically bickering, teasing, picking at each other’s sore spots. Brian is the single one, the ambitious one. He wants to make detective. He’s willing to take a shortcut or two to get there.

Mike is more blue collar — happily married, a father, happy to be where he is in the force. But the uniform hasn’t taken the chip off his shoulder. Call him the wrong name when he’s arresting you and it’s “Go time.”

Over the course of a year, we see the shifting fortunes of their lives, shootings that have to be justified by their department, and a steadily escalating violence that spills over the border from Mexico, whose ruthless drug cartels deal in “dope, money and guns — all the major food groups.” Mike and Brian find themselves stumbling into more and more cartel business as their year passes them by.

Gyllenhaal brings a swashbuckling bravado to Brian, a guy who is something of a player when it comes to the ladies. He’s not above hooking up with groupies (“Badge Bunnies”), but might be tempted when somebody special (like Anna Kendrick) comes along.

Mike has matured in different ways, clinging to juvenile neighborhood notions of “respect,” but adult enough to know love when he sees it.

Ayer’s film begins with a long lull: 45 minutes of procedure, depiction of the cop community (America Ferrara and Cody Horn are fellow officers) and light touches. The police are bilingual, by necessity, aware of where they can make a difference and when they need to walk away. The calls they answer range from fires to missing children , loud parties to “shots fired — officer down.”

The banter between our two heroes is easy, informal, with goofy moments of the sort of race-baiting that only two close friends could get away with. It’s all underlined with “I love you, man.”

They can joke about pulling a guy over and confiscating a gold-plated assault rifle (“It’s Liberace’s AK-47!”). But we can sense what’s coming, even if they can’t.

Page 2 of 2 - Their guns are out of their holsters more, the threat of violence gathers like clouds over the city.

Ayer resorts to that favorite crutch of current filmmakers — the hand-held video recorder (Brian is doing a video project for his night school class), but is so inconsistent with it that he abandons that point of view in mid-scene.

What he manages most masterfully here is the drip-drip-drip of rising tension, a build-up that leaves you with a sense of dread even as you watch characters enjoy the off-duty joys of life — a quinceanera party, a medal ceremony.

And Pena and Gyllenhaal so fully inhabit these wellrounded characters that you worry for them, worry about what they’ll do on this day or night when they climb into their cruiser, and what will become of them by the end of this watch.